:root {
  --brand-yellow: #f5c542;
  --brand-yellow-soft: #ffe9a6;
  --brand-yellow-light: #fff7d6;
  --brand-cream: #fffdf6;
  --brand-paper: #faf5e8;
  --brand-card: #ffffff;
  --brand-border: #ede4ce;
  --brand-black: #111111;
  --brand-text: #1b1b1b;
  --brand-muted: #6f6f6f;
  --success: #22a861;
  --success-soft: #e8f8ef;
  --warning: #f5b700;
  --warning-soft: #fff3c4;
  --info: #3b82f6;
  --info-soft: #eaf2ff;
  --danger: #e5484d;
  --danger-soft: #ffedee;
  --shadow: 0 18px 50px rgba(17, 17, 17, 0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Manrope, Arial, sans-serif;
  color: var(--brand-text);
  background:
    radial-gradient(rgba(17,17,17,0.045) 1px, transparent 1px),
    var(--brand-cream);
  background-size: 18px 18px;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}
a { color: inherit; text-decoration: none; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 224px 1fr;
  grid-template-rows: 76px 1fr;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 44px;
  background: linear-gradient(180deg, #ffdf72 0%, #f5c542 100%);
  border-bottom: 1px solid rgba(17,17,17,0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-brand-group {
  display: flex;
  align-items: center;
  min-width: 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #171717;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.04em;
}
.logo img {
  display: block;
  width: 46px;
  height: 46px;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.product-context {
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid rgba(23, 23, 23, 0.22);
  color: rgba(23, 23, 23, 0.68);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.logo svg, .topbar svg, .sidebar svg, .main svg { width: 18px; height: 18px; stroke-width: 2.2; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  font-weight: 700;
}
.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.7);
}
.bookautoai-credit-icon {
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
}
.header-link {
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.auth-controls {
  min-width: 116px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.auth-loading {
  font-size: 12px;
  font-weight: 600;
  color: rgba(20, 20, 20, 0.68);
}
.auth-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(20, 20, 20, 0.22);
  background: rgba(255, 255, 255, 0.62);
  color: #171717;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.auth-button.primary {
  border-color: #171717;
  background: #171717;
  color: #fff;
}
.auth-button:hover { filter: brightness(0.96); }
#clerk-user-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.sidebar {
  grid-row: 2;
  background: rgba(255, 251, 239, 0.88);
  border-right: 1px solid var(--brand-border);
  padding: 30px 18px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 76px;
  height: calc(100vh - 76px);
}
.nav-list { display: grid; gap: 8px; }
.nav-list a {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 700;
  color: #232323;
}
.nav-list a.active {
  background: linear-gradient(90deg, var(--brand-yellow-light), rgba(255,233,166,0.75));
}
.sidebar-bottom { display: grid; gap: 22px; }
.upgrade-card {
  padding: 18px 18px;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--brand-border);
  border-radius: 14px;
}
.upgrade-card svg { color: var(--warning); fill: var(--warning); }
.upgrade-card h3 { margin: 8px 0 4px; font-size: 14px; }
.upgrade-card p { margin: 0; color: var(--brand-muted); font-size: 12px; line-height: 1.45; }
.whats-new {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  font-weight: 700;
  font-size: 13px;
}
.whats-new span {
  margin-left: auto;
  width: 7px;
  height: 7px;
  background: var(--warning);
  border-radius: 999px;
}

.main {
  grid-column: 2;
  grid-row: 2;
  padding: 38px 44px 46px;
}
.page {
  max-width: 1180px;
  margin: 0 auto;
}
.drive-page {
  max-width: 1680px;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.page-title h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: 0;
}
.page-title p {
  margin: 8px 0 0;
  color: var(--brand-muted);
  font-weight: 600;
}
.grid { display: grid; gap: 22px; }
.grid.two { grid-template-columns: minmax(0, 1fr) 330px; }
.grid.editor { grid-template-columns: 300px minmax(520px, 1fr) 350px; align-items: start; }
.grid.projects { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.bulk-layout { max-width: 1180px; }
.mode-switch {
  width: fit-content;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 0 0 22px;
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  background: rgba(255,255,255,0.76);
}
.mode-switch button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  color: var(--brand-muted);
}
.mode-switch button.active {
  background: var(--warning);
  color: #111;
}
.card {
  background: rgba(255,255,255,0.88);
  border: 1px solid var(--brand-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.panel { padding: 22px; }
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-title {
  margin: 0 0 16px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--brand-border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
  white-space: nowrap;
}
.btn.primary {
  border-color: #e9aa00;
  background: linear-gradient(180deg, #ffc72c, #f5b700);
  color: #111;
}
.btn.ghost { background: rgba(255,255,255,0.65); }
.btn.full { width: 100%; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.is-loading svg { animation: button-spin 0.9s linear infinite; }
@keyframes button-spin { to { transform: rotate(360deg); } }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.badge.yellow { background: var(--warning-soft); color: #8a6200; }
.badge.green { background: var(--success-soft); color: #147a45; }
.badge.red { background: #fde8e7; color: #b42318; }
.badge.blue { background: var(--info-soft); color: #2365bd; }
.badge.gray { background: #f0f0ee; color: #575757; }
.status-dot { width: 8px; height: 8px; border-radius: 999px; background: currentColor; }

.metric-row { display: grid; grid-template-columns: repeat(5,1fr); gap: 14px; margin-bottom: 20px; }
.metric {
  padding: 17px;
  min-height: 84px;
}
.metric strong { display: block; font-size: 22px; }
.metric span { display: block; color: var(--brand-muted); font-size: 12px; font-weight: 700; }

.project-list { overflow: hidden; }
.loading-spinner { display: inline-flex; line-height: 0; }
.loading-spinner svg { animation: project-loader-spin .8s linear infinite; transform-origin: center; }
@keyframes project-loader-spin { to { transform: rotate(360deg); } }
.project-list.is-refreshing { position: relative; }
.project-refresh-indicator { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 12px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.project-pagination { display: flex; gap: 6px; }
@media (prefers-reduced-motion: reduce) {
  .loading-spinner svg { animation-duration: 1.8s; }
}

/* The editor inspector can collapse into a narrow rail so the page canvas gets
   the working space back without hiding the control used to reopen it. */
.settings-panel {
  min-width: 0;
}

.editor-inspector-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.editor-inspector-toggle {
  min-height: 34px;
  padding-inline: 10px;
}

.editor-inspector-content {
  min-width: 0;
}

.settings-panel.is-collapsed {
  padding: 8px;
}

.settings-panel.is-collapsed .editor-inspector-toolbar {
  margin-bottom: 0;
}

.settings-panel.is-collapsed .editor-inspector-toggle {
  width: 100%;
  padding-inline: 0;
}

.settings-panel.is-collapsed .editor-inspector-toggle span {
  display: none;
}

@media (min-width: 1181px) {
  .grid.editor.inspector-collapsed {
    grid-template-columns: minmax(290px, 300px) minmax(0, 1fr) 56px;
  }
}

@media (max-width: 1180px) {
  .settings-panel.is-collapsed {
    width: 100%;
    justify-self: stretch;
  }

  .settings-panel.is-collapsed .editor-inspector-toggle {
    width: auto;
    padding-inline: 10px;
  }

  .settings-panel.is-collapsed .editor-inspector-toggle span {
    display: inline;
  }
}
.project-row {
  display: grid;
  grid-template-columns: 78px minmax(0,1fr) auto auto auto;
  align-items: center;
  gap: 18px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--brand-border);
}
.project-row[hidden],
.project-filter-empty[hidden] {
  display: none !important;
}
.project-delete-button {
  color: #a63d32;
  border-color: rgba(166, 61, 50, 0.28);
}
.project-delete-button:hover:not(:disabled),
.project-delete-button:focus-visible {
  background: #fff0ed;
  color: #8f2d24;
  border-color: rgba(166, 61, 50, 0.55);
}
.project-status-control select {
  min-height: 32px;
  padding: 4px 30px 4px 12px;
  border: 1px solid #d8cfbc;
  border-radius: 999px;
  background: #f7f6f2;
  color: #4f4f4f;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.project-status-control select:disabled {
  cursor: wait;
  opacity: 0.65;
}
.project-row:last-child { border-bottom: 0; }
.thumb, .cover {
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(17,17,17,0.08);
}
.thumb { width: 64px; height: 78px; }
.cover { width: 116px; height: 154px; }
.live-placeholder {
  background:
    linear-gradient(135deg, rgba(245, 197, 66, 0.18), rgba(34, 168, 97, 0.16)),
    #fffaf0;
  border: 1px dashed #d9c9a9;
  color: #7a5a00;
  display: grid;
  place-items: center;
  font-weight: 900;
  text-align: center;
}
.live-placeholder span { padding: 6px; }
.empty-state {
  display: grid;
  gap: 6px;
  place-items: center;
  padding: 34px 18px;
  color: var(--brand-muted);
  text-align: center;
}
.empty-state.compact { padding: 20px 16px; }
.empty-state strong { color: var(--brand-text); }
.project-row h3 { margin: 0 0 8px; font-size: 18px; }
.meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: #7b7b7b; font-size: 13px; font-weight: 700; }
.dot-sep { color: #b6aa95; }

.searchbar, .filterbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.grid.projects .searchbar { flex-wrap: wrap; }
.searchbar label {
  flex: 1;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  background: #fff;
  color: #8c8c8c;
}
.searchbar input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--brand-text);
}
.pill-filter {
  height: 38px;
  border: 1px solid var(--brand-border);
  background: #fff;
  border-radius: 999px;
  padding: 0 14px;
  font-weight: 800;
}
.pill-filter.active { border-color: var(--warning); background: var(--brand-yellow-light); }

.form-card { padding: 18px 22px; }
.form-grid { display: grid; gap: 14px; }
.field {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}
.field span {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
}
.input, .select, .stepper {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--brand-border);
  border-radius: 9px;
  background: #fff;
  padding: 0 14px;
  color: #6b6b6b;
  font-weight: 600;
}
.textarea {
  min-height: 150px;
  padding: 12px 14px;
  line-height: 1.45;
  resize: vertical;
}
.stepper {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: 0;
  overflow: hidden;
}
.stepper button {
  height: 42px;
  border: 0;
  background: #fff;
  font-weight: 800;
}
.stepper strong { text-align: center; font-size: 13px; }
.choice-row { display: grid; grid-template-columns: repeat(2,1fr); gap: 18px; }
.choice {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  background: #fff;
}
.radio {
  width: 20px;
  height: 20px;
  border: 2px solid #ddd2bb;
  border-radius: 999px;
  display: inline-block;
  position: relative;
}
.choice.active .radio { border-color: var(--warning); }
.choice.active .radio::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--warning);
  border-radius: inherit;
}
.choice strong { display: block; font-size: 13px; }
.choice small { color: var(--brand-muted); font-weight: 700; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.form-message {
  max-width: 560px;
  margin: 12px auto 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}
.form-message.error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(229, 72, 77, 0.22);
}
.form-message.success {
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid rgba(34, 168, 97, 0.22);
}
.form-message.warning {
  color: #8a6200;
  background: var(--warning-soft);
  border: 1px solid rgba(245, 183, 0, 0.28);
}
.job-error {
  max-width: none;
  margin: 12px 0 14px;
  display: grid;
  gap: 4px;
  line-height: 1.35;
}
.job-error strong,
.job-error span {
  display: block;
}
.ai-status-message {
  max-width: none;
  margin: 10px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-card { text-align: left; }
.preview-card .cover { margin: 12px auto 18px; width: 150px; height: 210px; }
.summary-line {
  min-height: 62px;
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  margin-top: 12px;
}
.summary-line svg { color: var(--warning); }
.summary-line strong { display: block; font-size: 13px; }
.summary-line span { color: var(--brand-muted); font-size: 12px; font-weight: 700; }
.output-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.output {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  font-size: 12px;
  font-weight: 800;
}
.output i {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-style: normal;
}

.automation-summary {
  display: grid;
  grid-template-columns: repeat(9, minmax(42px, 1fr));
  align-items: center;
  gap: 12px;
  text-align: center;
}
.step-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 9px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--brand-yellow-light);
  color: #b17700;
}
.automation-summary strong { font-size: 12px; }
.automation-summary p { margin: 4px 0 0; color: var(--brand-muted); font-size: 11px; line-height: 1.35; font-weight: 700; }
.arrow { color: #a69475; font-weight: 900; }

.pipeline-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  align-items: center;
}
.pipeline-card .cover { width: 124px; height: 170px; }
.pipeline-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.pipeline-head h2 { margin: 0; font-size: 22px; }
.pipeline-labels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  text-align: center;
  margin: 20px 0 12px;
}
.pipeline-stage {
  display: grid;
  place-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
}
.stage-dot {
  width: 31px;
  height: 31px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 2px solid #d9d9d9;
  background: #fff;
  color: #9a9a9a;
}
.pipeline-stage.done .stage-dot, .pipeline-stage.active .stage-dot {
  border-color: var(--warning);
  background: var(--warning);
  color: #fff;
}
.progress-track {
  height: 9px;
  background: #eee9dd;
  border-radius: 999px;
  overflow: hidden;
}
.progress-track span { display: block; height: 100%; width: 68%; background: var(--warning); }
.progress-track.indeterminate span {
  width: 38%;
  animation: progress-slide 1.05s ease-in-out infinite;
}
.pdf-export-progress {
  width: min(640px, 100%);
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(245, 183, 0, 0.38);
  border-radius: 12px;
  background: #fffaf0;
  color: var(--brand-ink);
}
.pdf-export-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 900;
}
.pdf-export-progress-head strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pdf-export-progress-head svg {
  flex: 0 0 auto;
  animation: button-spin 0.9s linear infinite;
}
.pdf-export-progress-head span {
  color: #8a6200;
  font-size: 14px;
}
.pdf-export-progress-track {
  position: relative;
  height: 12px;
}
.pdf-export-progress-track span {
  min-width: 2%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f5b700, #ffd767, #f5b700);
  background-size: 200% 100%;
  transition: width 0.45s ease;
  animation: pdf-progress-shimmer 1.3s linear infinite;
}
.pdf-export-progress p {
  margin: 9px 0 0;
  color: var(--brand-muted);
  font-size: 11px;
  font-weight: 800;
}
@keyframes pdf-progress-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
@keyframes progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}
.create-progress {
  width: min(720px, 100%);
  margin: 16px auto 0;
  display: grid;
  gap: 10px;
  text-align: left;
}
.create-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  font-size: 13px;
  font-weight: 900;
}
.create-progress-head span {
  color: var(--brand-muted);
}
.create-progress-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.create-progress-steps span {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  color: var(--brand-muted);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.create-progress-steps span.done {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(34, 168, 97, 0.22);
}
.create-progress p {
  margin: 0;
  text-align: center;
}
.bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.bulk-button-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}
.bulk-credit {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: #8a6200;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
}
.bulk-workspace {
  max-width: 1180px;
  padding: 0;
  overflow: hidden;
  gap: 0;
}
.bulk-workspace-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 14px 0;
  border-bottom: 1px solid var(--brand-border);
  background: #fffdfa;
}
.bulk-workspace-tabs button {
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--brand-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}
.bulk-workspace-tabs button.active {
  border-bottom-color: #d6a600;
  color: var(--brand-text);
}
.bulk-workspace-tabs button span {
  min-width: 22px;
  min-height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff0bd;
  display: inline-grid;
  place-items: center;
  font-size: 11px;
}
.bulk-workspace-body {
  padding: 22px;
  display: grid;
  gap: 20px;
}
.bulk-workspace-body .bulk-layout > .card,
.bulk-workspace-body > .card {
  box-shadow: none;
}
.bulk-history-panel {
  display: grid;
  gap: 14px;
}
.bulk-history-search {
  min-height: 44px;
  padding-left: 13px;
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--brand-muted);
}
.bulk-history-search .input {
  min-height: 42px;
  padding-left: 0;
  border: 0;
  box-shadow: none;
}
.bulk-conflict-panel {
  width: 100%;
  padding: 14px;
  border: 1px solid #efb5b5;
  border-radius: 12px;
  background: #fff4f4;
  display: grid;
  gap: 12px;
  color: #9e3838;
}
.bulk-conflict-summary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.bulk-conflict-summary div,
.bulk-conflict-row span {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.bulk-conflict-summary small,
.bulk-conflict-row small {
  color: #805252;
  font-weight: 700;
}
.bulk-conflict-panel details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}
.bulk-conflict-list {
  max-height: 230px;
  margin-top: 10px;
  overflow: auto;
  border-top: 1px solid #edcccc;
}
.bulk-conflict-row {
  min-height: 52px;
  padding: 8px 0;
  border-bottom: 1px solid #edcccc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.bulk-history-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.bulk-history-tabs button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.bulk-history-tabs button span {
  min-width: 22px;
  min-height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f4eedf;
  color: var(--brand-text);
  display: inline-grid;
  place-items: center;
}
.bulk-history-tabs button.active {
  border-color: #dba900;
  background: var(--warning-soft);
  color: #765600;
}
.bulk-history-list {
  display: grid;
  gap: 8px;
}
.bulk-history-row {
  position: relative;
  width: 100%;
  min-width: 0;
  padding: 13px 14px 16px;
  overflow: hidden;
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  background: #fffdfa;
  color: var(--brand-text);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  text-align: left;
  font: inherit;
}
.bulk-history-row:hover {
  border-color: #d9b84d;
  background: #fffaf0;
}
.bulk-history-row.active {
  border-color: #d6a600;
  box-shadow: 0 0 0 2px rgba(255, 190, 0, 0.12);
}
.bulk-history-open {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.bulk-history-delete {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #efc9c5;
  border-radius: 9px;
  background: #fff;
  color: #a63d32;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.bulk-history-delete:hover:not(:disabled) {
  border-color: #d96b60;
  background: #fff0ee;
}
.bulk-history-delete:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.bulk-history-delete svg {
  width: 17px;
  height: 17px;
}
.bulk-history-main,
.bulk-history-meta {
  min-width: 0;
  display: flex;
}
.bulk-history-main {
  flex-direction: column;
  gap: 3px;
}
.bulk-history-main strong,
.bulk-history-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bulk-history-main strong {
  font-size: 13px;
}
.bulk-history-main small,
.bulk-history-meta small {
  color: var(--brand-muted);
  font-size: 11px;
  font-weight: 700;
}
.bulk-history-meta {
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.bulk-history-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  background: #eee8da;
}
.bulk-history-progress span {
  height: 100%;
  display: block;
  background: var(--brand-yellow);
}
.bulk-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.bulk-stats span {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  background: rgba(255,255,255,0.72);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--brand-muted);
  font-size: 12px;
  font-weight: 900;
}
.table-wrap { overflow-x: auto; }
.bulk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.bulk-table th,
.bulk-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--brand-border);
  text-align: left;
  vertical-align: top;
}
.bulk-table th {
  color: var(--brand-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.bulk-table td small {
  display: block;
  margin-top: 3px;
  color: var(--brand-muted);
  font-weight: 700;
}
.bulk-project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bulk-full-book-row-progress {
  display: grid;
  gap: 4px;
  min-width: 130px;
  margin-top: 8px;
  color: var(--brand-muted);
  font-size: 11px;
  font-weight: 800;
}
.bulk-full-book-row-progress .progress-track {
  height: 6px;
}
.bulk-full-book-complete { color: var(--success); }
.bulk-full-book-failed { color: #a63d32; }
.bulk-full-book-progress {
  max-width: 860px;
}
.activity-list { display: grid; }
.activity {
  min-height: 54px;
  display: grid;
  grid-template-columns: 28px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--brand-border);
}
.activity:first-child { border-top: 0; }
.activity strong { display: block; font-size: 13px; }
.activity span, .activity time { color: var(--brand-muted); font-size: 12px; font-weight: 700; }

.side-stack { display: grid; gap: 18px; }
.stat-lines { display: grid; gap: 17px; }
.stat-line { display: flex; justify-content: space-between; font-weight: 800; font-size: 13px; }
.control-stack { display: grid; gap: 12px; }

.drive-status {
  display: grid;
  gap: 18px;
}
.drive-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}
.drive-identity {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 18px;
}
.drive-identity-copy {
  min-width: 0;
}
.drive-identity-copy .section-title {
  margin-bottom: 6px;
}
.drive-identity-copy p {
  max-width: 420px;
  margin: 0;
  line-height: 1.55;
}
.drive-status-actions {
  display: flex;
  flex: 2 1 520px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.drive-status-actions .btn {
  margin: 0;
  white-space: nowrap;
}
.drive-quality-flow {
  flex: 1 1 680px;
  min-width: min(680px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
}
.drive-match-cta {
  display: grid;
  align-content: start;
  gap: 6px;
  height: 100%;
  padding: 10px;
  border: 1px solid #e5b62d;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffaf0, #fff5d8);
  box-shadow: 0 10px 24px rgba(169, 121, 0, 0.14);
}
.drive-match-eyebrow {
  color: #8a6400;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}
.drive-match-button {
  width: 100%;
  min-height: 48px;
  justify-content: center;
  border-color: #c98e00;
  font-size: 14px;
  box-shadow: 0 5px 12px rgba(169, 121, 0, 0.2);
}
.drive-match-button svg {
  width: 20px;
  height: 20px;
}
.drive-match-note {
  margin: 0;
  color: #62583f;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.45;
}
.smart-pairing-pro-card {
  position: relative;
  min-width: 0;
  height: 100%;
  padding: 14px;
  overflow: hidden;
  border: 1px solid #e5ad28;
  border-radius: 16px;
  background:
    radial-gradient(circle at 92% 8%, rgba(255, 183, 43, 0.3), transparent 38%),
    linear-gradient(145deg, #fffdf7 0%, #fff0c8 100%);
  box-shadow: 0 12px 30px rgba(169, 101, 0, 0.14);
  display: grid;
  gap: 9px;
}
.smart-pairing-pro-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #ffd14f, #e78312);
}
.smart-pairing-pro-card > * {
  position: relative;
}
.smart-pairing-pro-card strong {
  color: #1c1824;
  font-size: 15px;
  line-height: 1.25;
}
.smart-pairing-pro-card p,
.smart-pairing-pro-card small {
  margin: 0;
  color: #655f6d;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
}
.smart-pairing-pro-eyebrow {
  color: #895500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.smart-pairing-pro-badge {
  padding: 3px 7px;
  border: 1px solid rgba(166, 99, 0, 0.28);
  border-radius: 999px;
  background: #ffedb1;
  color: #7a4a00;
  line-height: 1;
}
.smart-pairing-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
}
.smart-pairing-benefits span {
  color: #514b58;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 800;
}
.smart-pairing-benefits svg {
  width: 12px;
  height: 12px;
  color: #20824c;
}
.smart-pairing-pro-card .smart-pairing-button,
.smart-pairing-pro-card .smart-pairing-upgrade-button {
  width: 100%;
  min-height: 44px;
  justify-content: center;
  border-color: #c47b00;
  background: linear-gradient(135deg, #ffd45a, #f3a51d);
  color: #2b210c;
  box-shadow: 0 8px 18px rgba(184, 107, 0, 0.22);
}
.smart-pairing-pro-card .smart-pairing-button:hover:not(:disabled),
.smart-pairing-pro-card .smart-pairing-upgrade-button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #ffdc72, #f7b638);
  box-shadow: 0 10px 22px rgba(184, 107, 0, 0.28);
}
.smart-pairing-pro-card.is-loading {
  min-height: 112px;
  align-content: center;
}
.smart-pairing-summary {
  padding: 7px 10px;
  border: 1px solid #dfd4b8;
  border-radius: 999px;
  background: #fffaf0;
  color: #62583f;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}
.smart-pairing-upgrade-dialog {
  width: min(620px, calc(100vw - 28px));
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 24px;
  background: transparent;
  color: var(--brand-text);
}
.smart-pairing-upgrade-dialog::backdrop {
  background: rgba(20, 16, 25, 0.64);
  backdrop-filter: blur(5px);
}
.smart-pairing-upgrade-card {
  position: relative;
  padding: 34px;
  overflow: hidden;
  border: 1px solid rgba(245, 197, 66, 0.45);
  border-radius: 24px;
  background:
    radial-gradient(circle at 100% 0, rgba(245, 197, 66, 0.3), transparent 36%),
    linear-gradient(145deg, #fffefb, #f7f0e1);
  box-shadow: 0 30px 80px rgba(12, 8, 18, 0.35);
  display: grid;
  gap: 16px;
}
.smart-pairing-upgrade-card h2,
.smart-pairing-upgrade-card p {
  margin: 0;
}
.smart-pairing-upgrade-card h2 {
  max-width: 520px;
  font-size: clamp(25px, 4vw, 38px);
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.smart-pairing-upgrade-card > p {
  color: #5f5867;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
}
.smart-pairing-dialog-close {
  position: absolute;
  z-index: 1;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #ddd1b6;
  border-radius: 50%;
  background: rgba(255,255,255,0.78);
  color: #43394a;
  display: grid;
  place-items: center;
}
.smart-pairing-dialog-benefits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.smart-pairing-dialog-benefits span {
  min-width: 0;
  padding: 11px;
  border: 1px solid #e4dac3;
  border-radius: 12px;
  background: rgba(255,255,255,0.65);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
}
.smart-pairing-dialog-benefits svg {
  flex: 0 0 auto;
  color: #7653a2;
}
.smart-pairing-upgrade-card .smart-pairing-dialog-note {
  padding: 11px 13px;
  border-radius: 10px;
  background: #fff6d8;
  color: #685516;
  font-size: 11px;
}
.smart-pairing-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}
.drive-status-content {
  min-width: 0;
}
.drive-logo {
  flex: 0 0 auto;
  width: 58px;
  height: 52px;
  background: conic-gradient(from 60deg, #22a861, #f5b700, #3b82f6, #22a861);
  clip-path: polygon(50% 0,100% 90%,0 90%);
}
.drive-logo.inactive {
  filter: grayscale(1);
  opacity: 0.35;
}
.print-quality-assurance {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--brand-border);
  color: var(--brand-muted);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.55;
}
.print-quality-assurance-label {
  margin-right: 8px;
  color: #8b6a1b;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.print-quality-assurance strong {
  margin-right: 5px;
  color: var(--brand-text);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: -0.01em;
}
.print-quality-assurance-detail {
  color: var(--brand-muted);
}
.editor-canvas-panel > .print-quality-assurance {
  margin: 0 18px 14px;
  padding-top: 10px;
}
.scan-health {
  display: grid;
  gap: 3px;
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid #b8dfc4;
  border-radius: 12px;
  background: #edf9f1;
  color: #277745;
  font-size: 12px;
}
.scan-health.warning {
  border-color: #e8c66c;
  background: #fff7dc;
  color: #855d08;
}
.scan-health span { font-weight: 700; }
.scan-diagnostics {
  max-width: 760px;
  font-size: 12px;
}
.scan-diagnostics > summary {
  cursor: pointer;
  font-weight: 900;
}
.scan-diagnostics-grid {
  display: grid;
  grid-template-columns: minmax(140px, auto) minmax(220px, 1fr);
  gap: 7px 12px;
  margin-top: 12px;
}
.scan-diagnostics-grid > span { color: var(--brand-muted); font-weight: 800; }
.scan-diagnostics code { overflow-wrap: anywhere; }
.scan-diagnostics p { margin: 10px 0 0; line-height: 1.55; }
.image-coverage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.coverage-card {
  min-height: 104px;
  align-content: center;
  gap: 8px;
}
.coverage-card span:not(.step-icon) {
  color: var(--brand-muted);
  font-size: 12px;
  font-weight: 800;
}
.coverage-card strong {
  font-size: 26px;
  line-height: 1;
}
.image-slots-panel {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}
.image-slots-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.image-slots-head .section-title {
  margin-bottom: 6px;
}
.image-slots-head p {
  max-width: 100%;
}
.image-slots-scroll {
  min-height: 900px;
  max-height: 1600px;
  height: clamp(1000px, 126vh, 1600px);
  overflow-y: auto;
  overflow-x: hidden;
  overflow-anchor: none;
  overscroll-behavior-y: auto;
  scroll-behavior: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding-right: 10px;
  scrollbar-gutter: stable;
}
.image-slots-scroll::-webkit-scrollbar {
  width: 10px;
}
.image-slots-scroll::-webkit-scrollbar-track {
  background: #fbf7ee;
  border-radius: 999px;
}
.image-slots-scroll::-webkit-scrollbar-thumb {
  background: #dfd2b9;
  border: 2px solid #fbf7ee;
  border-radius: 999px;
}
.image-library-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
}
.image-library-actions > .form-message { grid-column: 1 / -1; }
.image-library-actions > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.image-library-actions > div:first-child strong {
  font-size: 15px;
}
.image-library-actions > div:first-child span {
  color: var(--brand-muted);
  font-size: 12px;
  font-weight: 800;
}
.image-library-action-buttons {
  display: grid;
  grid-template-columns: minmax(180px, auto);
  gap: 10px;
  align-items: center;
}
.image-library-action-buttons .btn {
  min-height: 44px;
  padding: 0 16px;
  justify-content: center;
  white-space: nowrap;
}
.credit-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(138, 98, 0, 0.22);
  color: #6f4f00;
  font-size: 11px;
  font-weight: 900;
}
.slot-group {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.slot-group:first-child {
  margin-top: 0;
}
.slot-group-head {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  background: #fffdfa;
}
.slot-group h3 {
  margin: 0;
  font-size: 16px;
}
.slot-group-head p {
  margin: 2px 0 0;
}
.slot-group-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.smart-pairing-control {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
}
.smart-pairing-control-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.smart-pairing-control-actions > span {
  color: var(--brand-muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}
.smart-pairing-control.is-running {
  width: min(520px, 48vw);
}
.slot-group-head .smart-pairing-inline-button {
  min-height: 38px;
  padding: 0 14px;
  border-color: #c47b00;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffd45a, #f3a51d);
  color: #2b210c;
  box-shadow: 0 6px 14px rgba(184, 107, 0, 0.18);
  white-space: nowrap;
}
.slot-group-head .smart-pairing-inline-button:not(:disabled):hover {
  border-color: #b66e00;
  background: linear-gradient(135deg, #ffdc72, #f7b638);
}
.slot-group-head .smart-pairing-inline-button svg {
  width: 16px;
  height: 16px;
}
.smart-pairing-button {
  border-color: #c47b00;
  background: #fff1be;
  color: #6f4500;
}
.smart-pairing-button:not(:disabled):hover {
  background: #ffe69a;
}
.smart-pairing-progress {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(196, 123, 0, 0.3);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.86);
}
.smart-pairing-progress-head,
.smart-pairing-progress-stage > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.smart-pairing-progress-head strong {
  min-width: 0;
  overflow: hidden;
  color: #513b0a;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.smart-pairing-progress-head > span,
.smart-pairing-progress-stage strong {
  color: #6f4f00;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}
.smart-pairing-progress-stage {
  display: grid;
  gap: 4px;
}
.smart-pairing-progress-stage > div > span {
  color: #6a6252;
  font-size: 10px;
  font-weight: 800;
}
.smart-pairing-progress-track {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee6d4;
}
.smart-pairing-progress-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f0a315, #ffd65c);
  transition: width 240ms ease;
}
.smart-pairing-progress-stage.is-complete .smart-pairing-progress-track > span {
  background: #2aa661;
}
.smart-pairing-progress-stage.is-waiting {
  opacity: 0.62;
}
.smart-pairing-progress.is-compact {
  min-width: 390px;
  padding: 9px 11px;
  box-shadow: 0 5px 16px rgba(112, 75, 0, 0.09);
}
.smart-pairing-result {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  color: #57505f;
}
.smart-pairing-result strong {
  color: #432c7a;
}
.slot-list {
  display: grid;
  gap: 8px;
}
.image-slot-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 400px;
  gap: 18px;
  align-items: center;
  min-height: 152px;
  padding: 14px;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: #fffdfa;
}
.image-slot-row.is-smart-recovering,
.image-slot-row.is-smart-warning {
  border-color: #d4a514;
  background: #fff8d6;
  box-shadow: inset 4px 0 0 #e6b91e;
}
.image-slot-row.is-smart-recovering {
  animation: smart-pairing-recovery-pulse 1.5s ease-in-out infinite;
}
.image-slot-row.is-smart-wrong {
  border-color: #d7655d;
  background: #ffe9e7;
  box-shadow: inset 4px 0 0 #d84b42;
}
@keyframes smart-pairing-recovery-pulse {
  0%, 100% { box-shadow: inset 4px 0 0 #e6b91e, 0 0 0 rgba(230, 185, 30, 0); }
  50% { box-shadow: inset 4px 0 0 #e6b91e, 0 0 0 3px rgba(230, 185, 30, 0.16); }
}
@media (prefers-reduced-motion: reduce) {
  .image-slot-row.is-smart-recovering { animation: none; }
}
.image-slot-row:has(.candidate-details[open]) {
  position: relative;
  z-index: 30;
}
.slot-thumb,
.slot-thumb img,
.slot-placeholder {
  width: 160px;
  height: 122px;
  border-radius: 8px;
}
.slot-thumb {
  position: relative;
  overflow: hidden;
  background: #f4eedf;
}
.slot-thumb .slot-thumbnail-placeholder,
.slot-thumb img {
  position: absolute;
  inset: 0;
}
.slot-thumb img {
  display: block;
  object-fit: cover;
  opacity: 0;
  transition: opacity 120ms ease-out;
}
.slot-thumb img.is-loaded {
  opacity: 1;
}
.slot-thumb.image-preview-unavailable::after {
  content: "Preview unavailable";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-bottom: 30px;
  background: rgba(255, 250, 238, 0.92);
  color: var(--brand-muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}
.image-preview-retry {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 13px;
  translate: -50% 0;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: #fff;
  padding: 5px 9px;
  color: var(--brand-text);
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.slot-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.selected-file-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px;
  max-width: 100%;
  overflow: hidden;
}
.selected-file-line strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}
.slot-title-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.slot-title-line strong {
  min-width: 0;
  max-width: 100%;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
  line-height: 1.15;
}
.slot-actions {
  width: 400px;
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) minmax(200px, 1.2fr);
  gap: 6px;
  justify-self: end;
  align-items: stretch;
}
.slot-actions .btn,
.slot-actions summary.btn {
  min-width: 0;
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  font-size: 11px;
  white-space: nowrap;
  justify-content: center;
}
.slot-actions .btn svg,
.slot-actions summary.btn svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}
.slot-action-choose {
  grid-column: 1;
  grid-row: 2;
}
.slot-action-generate {
  grid-column: 2;
  grid-row: 2;
}
.slot-action-generate .credit-chip {
  margin-left: auto;
  white-space: nowrap;
}
.candidate-details {
  min-width: 0;
  position: relative;
}
.candidate-details[open] {
  z-index: 40;
}
.candidate-details summary {
  list-style: none;
  cursor: pointer;
}
.candidate-details summary::-webkit-details-marker {
  display: none;
}
.candidate-menu {
  position: absolute;
  z-index: 20;
  right: 0;
  top: calc(100% + 8px);
  width: min(430px, 86vw);
  max-height: 420px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: #fffdfa;
  box-shadow: 0 18px 40px rgba(40, 29, 10, 0.18);
}
.candidate-menu > p {
  grid-column: 1 / -1;
}
.candidate-option {
  width: 100%;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: white;
  text-align: left;
  cursor: pointer;
}
.candidate-option.active {
  border-color: var(--warning);
  background: #fff7d6;
}
.candidate-option img,
.candidate-placeholder {
  width: 72px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
}
.candidate-option span {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.candidate-option strong {
  overflow-wrap: anywhere;
  font-size: 12px;
}
.candidate-option small {
  color: var(--brand-muted);
  font-weight: 800;
}
.candidate-option.candidate-image-tile {
  position: relative;
  display: block;
  min-width: 0;
  aspect-ratio: 1;
  padding: 3px;
  overflow: hidden;
  background: #fff;
}
.candidate-option.candidate-image-tile:hover {
  border-color: color-mix(in srgb, var(--warning), #9b6a00 25%);
  box-shadow: 0 3px 10px rgba(40, 29, 10, 0.13);
}
.candidate-option.candidate-image-tile:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--warning), transparent 25%);
  outline-offset: 2px;
}
.candidate-option.candidate-image-tile:disabled {
  cursor: wait;
  opacity: 0.62;
}
.candidate-option.candidate-image-tile img,
.candidate-option.candidate-image-tile .candidate-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 5px;
  object-fit: cover;
  pointer-events: none;
}
.candidate-option.candidate-image-tile img:not([src]) {
  background:
    linear-gradient(110deg, #f4eedf 25%, #fffaf0 42%, #f4eedf 58%);
  background-size: 220% 100%;
  animation: candidate-image-loading 1.15s linear infinite;
}
.candidate-placeholder.image-preview-unavailable {
  display: grid;
  place-items: center;
  padding: 8px;
  color: var(--brand-muted);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}
@keyframes candidate-image-loading {
  to { background-position-x: -220%; }
}
.candidate-selected-mark {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--warning);
  color: #241900;
  box-shadow: 0 2px 8px rgba(40, 29, 10, 0.24);
}
.candidate-selected-mark svg {
  width: 13px;
  height: 13px;
  stroke-width: 3;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  color: #8b8b8b;
  font-size: 11px;
  text-transform: uppercase;
  padding: 12px 10px 12px 0;
  border-bottom: 1px solid var(--brand-border);
  white-space: nowrap;
}
.table td {
  padding: 12px 10px 12px 0;
  border-bottom: 1px solid var(--brand-border);
  vertical-align: middle;
  font-weight: 700;
}
.table tr:last-child td { border-bottom: 0; }
.manifest-table {
  min-width: 760px;
}
.manifest-table td {
  vertical-align: top;
  line-height: 1.25;
}
.recipe-cell { display: flex; align-items: center; gap: 12px; }
.food-thumb { width: 50px; height: 44px; border-radius: 8px; background-size: cover; background-position: center; }
.recipe-live-row { grid-template-columns: 54px minmax(0, 1fr) auto auto; }
.image-rules-panel {
  align-self: start;
  padding: 20px;
}
.image-rules-panel > .section-title { margin-bottom: 4px; }
.image-rules-panel > p { margin: 0; line-height: 1.3; }
.image-rules-panel .rule-list { margin-top: 12px; }
.rule-list { display: grid; gap: 10px; }
.rule {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  text-align: left;
}
.rule span { min-width: 0; }
.rule strong,
.rule small {
  overflow-wrap: anywhere;
}
.image-rules-panel .rule .step-icon {
  width: 34px;
  height: 34px;
}
.rule-status {
  min-width: 54px;
  padding: 5px 9px;
  border: 1px solid #e2d9c7;
  border-radius: 999px;
  background: #f4f1e9;
  color: #746d60;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rule-status.active {
  border-color: #bfe7d2;
  background: #e9f8f0;
  color: #24724d;
}
.rule-status.manual {
  border-color: #eadba6;
  background: #fff7dc;
  color: #8a6200;
}
.rule-status.running {
  border-color: #d7c8f2;
  background: #f2ecff;
  color: #5d3c91;
}
.toggle {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--warning);
  position: relative;
}
.toggle::after {
  content: "";
  width: 18px;
  height: 18px;
  position: absolute;
  right: 3px;
  top: 3px;
  background: #fff;
  border-radius: inherit;
}
.toggle.off { background: #ddd4c1; }

.export-hero {
  display: grid;
  grid-template-columns: 126px 1fr 170px;
  align-items: center;
  gap: 24px;
  min-height: 190px;
}
.check-burst {
  width: 116px;
  height: 116px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, #fff 0 30%, #ffe9a6 31% 50%, transparent 51%);
  color: var(--warning);
}
.check-burst svg { width: 42px; height: 42px; }
.export-files-panel {
  display: grid;
  gap: 0;
}
.export-files-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.export-files-head .section-title {
  margin: 0;
}
.export-files-head > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-weight: 800;
}
.file-row {
  display: grid;
  grid-template-columns: 42px minmax(190px, 1fr) minmax(86px, auto) minmax(150px, auto) 132px;
  gap: 14px;
  align-items: center;
  min-height: 76px;
  padding: 12px 0;
  border-top: 1px solid var(--brand-border);
}
.export-files-head + .file-row { border-top: 0; }
.file-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  justify-self: start;
}
.file-icon.red { background: #ef4444; }
.file-icon.green { background: #22c55e; }
.file-icon.yellow { background: #fbbf24; }
.file-icon.purple { background: #8b5cf6; }
.file-icon.blue { background: #3b82f6; }
.file-primary {
  min-width: 0;
  display: grid;
  gap: 5px;
}
.file-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.file-title-line strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}
.file-primary small {
  color: var(--brand-muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}
.file-metric {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.file-metric span {
  color: var(--brand-muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}
.file-metric strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.file-download {
  width: 100%;
  justify-content: center;
}
.file-unavailable {
  width: 132px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  padding: 0 12px;
  border-radius: 10px;
  background: #f5f2eb;
  color: var(--brand-muted);
  font-size: 12px;
  font-weight: 900;
}

.template-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.single-template-grid { grid-template-columns: minmax(320px, 520px); }
.template-card { padding: 14px; }
.modern-template-card { display: grid; gap: 10px; }
.template-preview {
  height: 160px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  margin-bottom: 14px;
}
.template-preview-image {
  height: 360px;
  background-color: #faf6ef;
  background-size: contain;
  background-repeat: no-repeat;
  border: 1px solid var(--brand-border);
}
.template-card h3 { margin: 0 0 6px; }
.template-card p { margin: 0; color: var(--brand-muted); font-size: 13px; font-weight: 700; }
.template-meta-list {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  color: var(--brand-muted);
  font-size: 13px;
  font-weight: 800;
}
.template-meta-list span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toc-page { max-width: 1320px; }
.toc-summary {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) minmax(260px, auto);
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}
.toc-summary h2 { margin: 0 0 6px; }
.toc-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  grid-template-areas:
    "chapters intro"
    "chapters final";
  align-items: start;
}
.toc-intro-panel { grid-area: intro; }
.toc-chapters-panel { grid-area: chapters; }
.toc-final-panel { grid-area: final; }
.toc-side-panel,
.toc-chapters-panel,
.toc-chapter,
.toc-chapter-head > *,
.toc-chapter-title > *,
.recipe-title-row > *,
.recipe-title-main > * {
  min-width: 0;
}
.toc-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.toc-section-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 18px;
}
.toc-page-list { display: grid; gap: 12px; }
.toc-page-row {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  background: rgba(255,255,255,0.72);
}
.toc-copy {
  min-height: 180px;
}
.toc-chapter { display: grid; gap: 14px; }
.toc-chapter-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}
.toc-chapter-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.chapter-title-input {
  color: var(--brand-text);
  font-weight: 900;
}
.recipe-title-list { display: grid; gap: 8px; }
.recipe-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.recipe-title-main {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}
.recipe-title-main > span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--brand-yellow-light);
  color: #8a6200;
  font-size: 12px;
  font-weight: 900;
}
.recipe-title-actions,
.toc-chapter-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}
.recipe-title-actions .btn,
.toc-chapter-actions .btn {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

@media (max-width: 1180px) {
  .toc-grid {
    grid-template-areas:
      "intro"
      "chapters"
      "final";
  }
}

@media (max-width: 680px) {
  .toc-chapter-head,
  .toc-chapter-title,
  .recipe-title-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc-chapter-actions,
  .recipe-title-actions {
    justify-content: flex-end;
  }
}

.editor-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "info"
    "setup";
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  margin-bottom: 20px;
}
.book-info {
  grid-area: info;
  display: flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  gap: 14px;
  overflow: hidden;
}
.book-info .thumb { width: 56px; height: 64px; }
.book-info > div {
  min-width: 0;
  max-width: 100%;
}
.book-info h2 {
  max-width: min(100%, 760px);
  margin: 0 0 6px;
  display: -webkit-box;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.book-info .meta {
  flex-wrap: wrap;
  gap: 6px 10px;
}
.book-setup-controls {
  grid-area: setup;
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(260px, 360px) auto;
  gap: 12px;
  align-items: end;
  justify-self: start;
  width: min(100%, 760px);
  min-width: 0;
}
.book-setup-controls .editor-field {
  gap: 5px;
}
.book-setup-controls #setup-dirty-message {
  grid-column: 1 / -1;
  min-height: 16px;
  color: #8a6200;
  font-weight: 800;
}
.editor-subtoolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr) 350px;
  align-items: center;
  gap: 22px;
  margin: 0 0 20px;
}
.editor-subtoolbar .editor-mode-tabs {
  grid-column: 1;
  margin: 0;
  width: 100%;
}
.editor-subtoolbar .view-toggle {
  grid-column: 2;
  justify-self: end;
}
.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: #fffaf0;
}
.view-toggle button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}
.view-toggle button.active {
  background: var(--brand-yellow);
  color: #111;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.12);
}
.view-toggle svg {
  width: 18px;
  height: 18px;
}
.editor-zoom-control {
  grid-area: zoom;
  display: inline-flex;
  justify-self: end;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 10px;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: #fffaf0;
  color: var(--brand-text);
  font-weight: 900;
}
.editor-zoom-control svg {
  width: 18px;
  height: 18px;
}
.editor-zoom-control .select {
  min-width: 92px;
  min-height: 36px;
  padding: 6px 28px 6px 10px;
  background-color: #fffefa;
}
.setup-select {
  min-width: 0;
  cursor: pointer;
  background: #fffefa;
  color: var(--brand-text);
  position: relative;
  z-index: 3;
}
.toolbar-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  max-width: 660px;
}
.design-controls {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(280px, 0.9fr) minmax(430px, 1.45fr);
  gap: 12px;
  align-items: stretch;
  padding: 16px;
  margin-bottom: 20px;
  border-radius: 12px;
}
.design-select-field,
.text-toolbar {
  min-height: 88px;
  padding: 12px;
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  background: #fffefa;
}
.design-select-field > span,
.toolbar-label {
  color: #6d6048;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.design-select-field .select {
  min-height: 38px;
  margin-top: 8px;
  border-radius: 8px;
  background: #fff;
}
.design-select-field small {
  min-height: 14px;
  margin-top: 6px;
  color: var(--brand-muted);
  font-size: 11px;
  font-weight: 700;
}
.palette-field {
  position: relative;
}
.palette-swatches {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}
.palette-swatches span {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(17,17,17,0.12);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.45);
}
.text-toolbar {
  display: grid;
  grid-template-columns: auto 42px 42px 72px 76px 96px;
  gap: 8px;
  align-items: end;
}
.editor-mode-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  margin: 0 0 20px;
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  background: rgba(255,255,255,0.9);
  box-shadow: var(--shadow);
}
.editor-mode-tabs button {
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--brand-muted);
  font-weight: 900;
}
.editor-mode-tabs button.active {
  background: var(--brand-yellow);
  color: #111;
}
.template-assets-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  margin-bottom: 20px;
}
.template-assets-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.template-assets-head .section-title {
  margin-bottom: 4px;
}
.divider-active-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.divider-active-summary span {
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: #fffefa;
  color: var(--brand-muted);
  font-size: 12px;
  font-weight: 800;
}
.divider-active-summary strong {
  color: var(--brand-text);
  font-size: 11px;
  text-transform: uppercase;
}
.asset-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.asset-groups-scroll {
  max-height: 330px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  scrollbar-gutter: stable;
}
.asset-groups-scroll::-webkit-scrollbar {
  width: 10px;
}
.asset-groups-scroll::-webkit-scrollbar-track {
  background: #fbf7ee;
  border-radius: 999px;
}
.asset-groups-scroll::-webkit-scrollbar-thumb {
  background: #dfd2b9;
  border: 2px solid #fbf7ee;
  border-radius: 999px;
}
.asset-group {
  min-width: 0;
}
.asset-group h3 {
  margin: 0 0 8px;
  color: #6d6048;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.asset-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 8px;
}
.asset-icon-button {
  display: grid;
  place-items: center;
  min-height: 62px;
  padding: 6px;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: #fffefa;
  cursor: pointer;
}
.divider-choice-card {
  cursor: default;
}
.asset-icon-button:hover {
  border-color: var(--warning);
  background: var(--brand-yellow-light);
}
.asset-icon-button.active {
  border-color: var(--warning);
  background: var(--brand-yellow-light);
  box-shadow: inset 0 0 0 1px var(--warning);
}
.asset-icon-button img {
  max-width: 34px;
  max-height: 28px;
  object-fit: contain;
}
.asset-group-dividers .asset-icon-grid {
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  align-items: stretch;
}
.asset-group-dividers .asset-icon-button {
  min-height: 128px;
}
.asset-group-dividers .divider-choice-card {
  place-items: stretch;
  gap: 8px;
  padding: 10px;
}
.divider-preview {
  height: 34px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.asset-group-dividers .divider-preview img {
  width: 152px;
  max-width: 100%;
  max-height: 34px;
  object-fit: contain;
}
.divider-name {
  min-width: 0;
  overflow: hidden;
  color: var(--brand-text);
  font-size: 11px;
  line-height: 1.15;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.divider-choice-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}
.divider-choice-actions button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: #fff;
  color: var(--brand-muted);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}
.divider-choice-actions button span {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  margin: 0;
  border-radius: 999px;
  background: #f5f2eb;
  color: inherit;
  font-size: 10px;
  line-height: 1;
}
.divider-choice-actions button:hover,
.divider-choice-actions button.active {
  border-color: var(--warning);
  background: var(--warning);
  color: #111;
}
.divider-choice-actions button.active span {
  background: rgba(255,255,255,0.62);
}
.asset-icon-button > span {
  width: 100%;
  margin-top: 4px;
  overflow: hidden;
  color: var(--brand-muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn.icon-only {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: #fff;
}
.btn.icon-only.active {
  border-color: var(--warning);
  background: var(--warning);
  color: #111;
}
.compact-field {
  min-width: 0;
}
.align-field {
  min-width: 0;
}
.compact-field .input,
.compact-field .select,
.align-field .select {
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
}
.compact-field .input {
  text-align: center;
}
.pages-panel {
  max-height: calc(100vh - 170px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.page-strip-list {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.page-strip {
  display: grid;
  grid-template-columns: 28px 92px minmax(0,1fr) 22px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 152px;
  padding: 12px;
  border: 0;
  border-bottom: 1px solid var(--brand-border);
  background: transparent;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}
.page-strip:hover { background: rgba(255, 233, 166, 0.45); }
.page-strip.active { outline: 1px solid var(--warning); outline-offset: -1px; background: var(--brand-yellow-light); }
.page-strip.has-export-text-issue,
.page-strip.has-export-text-issue.active,
.main .page-strip.has-export-text-issue:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid var(--danger);
  outline-offset: -3px;
  background: var(--danger-soft);
}
.page-strip-label {
  min-width: 0;
}
.page-strip-label strong {
  display: block;
}
.page-strip-label small {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 7px;
  color: var(--danger);
  font-size: 10px;
  line-height: 1.2;
}
.page-strip-label small svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}
.page-strip em {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: #fffaf0;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}
.page-mini { width: 82px; height: 128px; border-radius: 8px; background-size: cover; background-position: center; }
.page-mini-image {
  overflow: hidden;
  border: 1px solid var(--brand-border);
  background: var(--brand-paper);
}
.book-canvas .template-page[data-export-text-issue="true"] {
  outline: 5px solid var(--danger);
  outline-offset: -5px;
}
.book-canvas .layout-zone[data-export-text-issue="true"] {
  z-index: 3;
  outline: 4px solid var(--danger) !important;
  outline-offset: -4px;
  background-color: rgba(229, 72, 77, 0.08);
}
.pdf-export-issues {
  width: min(100%, 920px);
  max-width: none;
  display: grid;
  gap: 10px;
  text-align: left;
}
.pdf-export-issues > strong {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
}
.pdf-export-issues > strong svg {
  width: 18px;
  height: 18px;
}
.pdf-export-issue-list {
  display: grid;
  gap: 8px;
}
.pdf-export-issue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid rgba(229, 72, 77, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}
.pdf-export-issue-row > div {
  display: grid;
  gap: 3px;
}
.pdf-export-issue-row span {
  color: inherit;
  font-weight: 700;
}
.pdf-export-issue-row .btn {
  flex: 0 0 auto;
}
.pages-image-actions {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--brand-border);
}
.pages-image-actions .pages-image-count {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--brand-yellow-light);
  color: #6f4f00;
  font-weight: 900;
}
.pages-image-actions .pages-image-count strong {
  font-size: 20px;
  line-height: 1;
}
.pages-image-actions .pages-image-count span {
  font-size: 12px;
}
.pages-image-actions .btn {
  min-height: 42px;
  justify-content: center;
}
.pages-image-library-first {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  padding: 11px;
  border: 1px solid #ead28d;
  border-radius: 10px;
  background: #fff9e8;
  color: #684e08;
}
.pages-image-library-first > svg {
  width: 20px;
  height: 20px;
  margin-top: 1px;
}
.pages-image-library-first > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.pages-image-library-first strong,
.pages-image-library-first span {
  overflow-wrap: anywhere;
}
.pages-image-library-first strong {
  font-size: 11px;
  line-height: 1.3;
}
.pages-image-library-first span {
  color: var(--brand-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}
.pages-image-library-link {
  border-color: #d6a91f;
  background: #fffdf6;
}
.image-batch-progress {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #f0ddaa;
  border-radius: 8px;
  background: #fffaf0;
}
.image-batch-progress > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--brand-ink);
  font-size: 12px;
  font-weight: 900;
}
.image-batch-progress > div:first-child span {
  color: var(--muted);
  white-space: nowrap;
}
.image-batch-progress p {
  margin: 0;
}
.page-mini-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.book-canvas {
  min-height: 655px;
  padding: 36px;
  background: #f4ead7;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  overflow: auto;
  overflow-anchor: none;
}
.canvas-toolbar {
  display: flex;
  width: 100%;
  justify-content: flex-end;
}
.canvas-toolbar .editor-zoom-control {
  grid-area: auto;
  justify-self: auto;
  box-shadow: 0 8px 22px rgba(17,17,17,0.08);
}
.canvas-stage {
  display: grid;
  width: 100%;
  min-height: 560px;
  place-items: center;
}
.template-page {
  width: min(520px, 100%);
  max-height: 620px;
  border-radius: 8px;
  box-shadow: 16px 20px 45px rgba(17,17,17,0.18);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(17,17,17,0.08);
  font-family: var(--font-body, Arial, sans-serif);
}
.single-page-frame {
  --editor-zoom-scale: 1;
  position: relative;
  display: grid;
  width: calc(520px * var(--editor-zoom-scale));
  min-width: calc(520px * var(--editor-zoom-scale));
  height: calc(var(--editor-page-height, 650px) * var(--editor-zoom-scale));
}
.single-page-frame .template-page {
  width: 520px;
  height: var(--editor-page-height, 650px);
  max-width: none;
  max-height: none;
  transform: scale(var(--editor-zoom-scale));
  transform-origin: top left;
}
.book-spread {
  --editor-zoom-scale: 1;
  width: max-content;
  max-width: none;
  display: grid;
  grid-template-columns: calc(520px * var(--editor-zoom-scale)) 22px calc(520px * var(--editor-zoom-scale));
  align-items: start;
  position: relative;
  filter: drop-shadow(18px 24px 38px rgba(17,17,17,0.18));
}
.spread-side {
  position: relative;
  display: grid;
  width: calc(520px * var(--editor-zoom-scale));
  min-width: calc(520px * var(--editor-zoom-scale));
  height: calc(var(--editor-page-height, 650px) * var(--editor-zoom-scale));
}
.spread-side .template-page {
  width: 520px;
  height: var(--editor-page-height, 650px);
  max-width: none;
  max-height: none;
  box-shadow: none;
  transform: scale(var(--editor-zoom-scale));
  transform-origin: top left;
}
.spread-side-left .template-page {
  border-radius: 8px 3px 3px 8px;
  box-shadow: -10px 14px 24px rgba(17,17,17,0.10);
}
.spread-side-right .template-page {
  border-radius: 3px 8px 8px 3px;
  box-shadow: 10px 14px 24px rgba(17,17,17,0.10);
}
.spread-gutter {
  position: relative;
  z-index: 4;
  background: linear-gradient(90deg, rgba(0,0,0,0.13), rgba(255,255,255,0.25) 42%, rgba(0,0,0,0.10));
}
.spread-side.active::after {
  content: "";
  position: absolute;
  inset: -4px;
  z-index: 6;
  pointer-events: none;
  border: 2px solid rgba(22, 133, 255, 0.65);
  border-radius: 10px;
  opacity: 0;
}
.layout-editing .spread-side.active::after,
.image-inspecting .spread-side.active::after {
  opacity: 1;
}
.spread-side-badge {
  position: absolute;
  top: 10px;
  z-index: 7;
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(17,17,17,0.12);
  border-radius: 999px;
  background: rgba(255,255,255,0.82);
  color: #6d6a60;
  font-size: 10px;
  font-weight: 900;
}
.spread-side-left .spread-side-badge { left: 10px; }
.spread-side-right .spread-side-badge { right: 10px; }
.blank-spread-page {
  display: grid;
  place-items: center;
  background: #fffdf6;
  color: rgba(109,106,96,0.55);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}
.layout-zone {
  position: absolute;
  overflow: hidden;
  word-break: normal;
  overflow-wrap: break-word;
}
.zone-label {
  display: none;
}
.layout-editing .layout-zone {
  outline: 1px dashed rgba(22, 133, 255, 0.42);
  outline-offset: -1px;
  cursor: pointer;
}
.layout-editing .layout-zone:hover {
  outline-color: #1685ff;
  background: rgba(22, 133, 255, 0.045);
}
.layout-editing .layout-zone.selected-layout-zone {
  outline: 2px solid #1685ff;
  background: rgba(22, 133, 255, 0.075);
}
.layout-editing .layout-zone .zone-label {
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 4;
  display: inline-flex;
  max-width: calc(100% - 4px);
  min-height: 16px;
  align-items: center;
  padding: 0 5px;
  border-radius: 5px;
  background: #1685ff;
  color: #fff;
  font-family: Manrope, Arial, sans-serif;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.layout-editing .inline-editable {
  cursor: pointer;
}
.layout-zone h2 {
  margin: 0;
  font-family: var(--font-display, inherit);
  font-size: clamp(18px, calc(var(--heading-size, 38px) * 0.72), 34px);
  line-height: 1.03;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.template-page:not(.recipe-page) .title-zone h2 {
  font-size: var(--page-title-render-size, clamp(18px, calc(var(--heading-size, 38px) * 0.72), 34px));
  line-height: 1.08;
}
.chapter-title-page {
  background: var(--template-paper, #fffdf6) !important;
  color: var(--template-text, #1f1f1f);
  font-family: var(--font-body, Arial, sans-serif);
}
.chapter-label-zone,
.chapter-title-zone,
.chapter-footer-zone {
  display: grid;
  place-items: center;
  text-align: center;
}
.chapter-label-zone h3 {
  margin: 0;
  color: var(--template-text, #1f1f1f);
  font-family: var(--font-body, Arial, sans-serif);
  font-size: clamp(24px, 4.4vw, 40px);
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: 0;
}
.chapter-title-zone h2 {
  max-width: 100%;
  margin: 0;
  color: var(--template-primary, #1f7a8c);
  font-family: var(--font-display, Georgia, serif);
  font-size: var(--chapter-title-render-size, clamp(22px, 3.8vw, 34px));
  font-weight: 900;
  line-height: 1.08;
  text-align: center;
  overflow-wrap: anywhere;
}
.chapter-title-zone {
  place-items: start center;
  box-sizing: border-box;
}
.chapter-footer-zone span {
  color: var(--template-primary, #1f7a8c);
  font-family: var(--font-body, Arial, sans-serif);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.book-toc-page {
  background: #fff !important;
  color: var(--template-text, #1f1f1f) !important;
  border-radius: 0;
  box-shadow: 10px 16px 30px rgba(17,17,17,0.12);
}
.toc-heading-zone h2 {
  margin: 0;
  color: var(--template-primary, #1f7a8c);
  font-family: var(--font-display, Manrope, sans-serif);
  font-size: clamp(20px, 3.4vw, 30px);
  font-weight: 800;
  line-height: 0.98;
}
.toc-entries-zone {
  overflow: hidden;
}
.toc-entry-list {
  column-count: 2;
  column-gap: 24px;
  color: var(--template-text, #1f1f1f);
  font-family: var(--font-body, Manrope, sans-serif);
  font-size: 8.7px;
  line-height: 1.12;
}
.book-toc-continuation-page .toc-entry-list {
  column-count: 2;
  max-width: none;
  margin-top: 0;
}
.toc-entry {
  break-inside: avoid;
  margin: 0 0 2px;
  overflow-wrap: anywhere;
}
.toc-entry.chapter-entry {
  margin: 9px 0 5px;
  font-weight: 900;
}
.toc-entry.chapter-entry:first-child {
  margin-top: 0;
}
.toc-entry .inline-toc-entry-label,
.toc-entry .toc-entry-page {
  display: inline;
}
.toc-page-number-zone {
  color: var(--template-muted, #6d6a60);
  font-size: 9px;
  font-weight: 700;
}
.generated-cover-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 58px 64px;
  background: var(--template-paper, #fffdf8) !important;
  color: var(--template-text, #1f1f1f);
  text-align: center;
}
.generated-cover-rule {
  width: 92px;
  height: 2px;
  margin-bottom: 38px;
  background: var(--template-primary, #1f1f1f);
}
.generated-cover-title {
  max-width: 88%;
  margin: 0;
  color: var(--template-text, #1f1f1f);
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(34px, 7vw, 52px);
  font-weight: 900;
  line-height: 1.05;
}
.generated-cover-byline-label {
  margin-top: auto;
  color: var(--template-muted, #666);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.generated-cover-byline {
  max-width: 84%;
  margin-top: 12px;
  color: var(--template-primary, #1f1f1f);
  font-family: var(--font-display, Georgia, serif);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
}
.generated-cover-rule-bottom {
  width: 44px;
  margin: 30px 0 0;
}
.copyright-page,
.thank-you-page {
  padding: 34px 46px 28px;
  background:
    radial-gradient(circle at 20% 18%, rgba(246,134,52,0.06), transparent 24%),
    radial-gradient(circle at 82% 12%, rgba(14,107,125,0.08), transparent 22%),
    #fffdf8 !important;
  color: #1f1f1f;
  border-radius: 6px;
}
.copyright-top-ornament,
.thank-you-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 18px;
}
.copyright-top-ornament img,
.thank-you-ornament img {
  max-width: 42px;
  max-height: 20px;
  object-fit: contain;
}
.copyright-top-ornament span,
.thank-you-ornament span {
  width: 44px;
  border-top: 1px solid var(--template-primary);
}
.copyright-page h1,
.thank-you-page h1 {
  margin: 12px 0 0;
  color: var(--template-primary);
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(34px, 7.4vw, 46px);
  font-weight: 900;
  line-height: 0.96;
  letter-spacing: 0;
  text-align: center;
}
.copyright-page h2,
.thank-you-page h2 {
  margin: 8px 0 0;
  color: var(--template-accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.2em;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
}
.copyright-divider,
.thank-you-divider {
  display: grid;
  place-items: center;
  height: 18px;
  margin: 9px auto 12px;
}
.copyright-divider img,
.thank-you-divider img {
  max-width: 220px;
  max-height: 16px;
  object-fit: contain;
}
.copyright-intro {
  width: 58%;
  margin: 0 0 10px;
  font-size: 9.2px;
  font-weight: 700;
  line-height: 1.25;
}
.copyright-sections {
  display: grid;
  width: 58%;
  gap: 7px;
}
.copyright-section {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  padding-top: 7px;
  border-top: 1px dotted var(--template-accent);
}
.copyright-section-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--template-primary), white 86%);
  color: var(--template-primary);
  font-size: 13px;
  font-weight: 900;
}
.copyright-section-icon-img {
  max-width: 24px;
  max-height: 24px;
  object-fit: contain;
}
.copyright-section h3 {
  margin: 0 0 3px;
  color: var(--template-primary);
  font-size: 9.2px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.copyright-section p {
  margin: 0;
  font-size: 8.4px;
  font-weight: 650;
  line-height: 1.24;
}
.copyright-side-card {
  position: absolute;
  right: 46px;
  top: 174px;
  width: 30%;
  height: 46%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 16px;
  border: 1px dashed var(--template-primary);
  border-radius: 10px;
  background: color-mix(in srgb, var(--template-primary), white 94%);
  text-align: center;
}
.copyright-side-card img {
  max-width: 42px;
  max-height: 42px;
  object-fit: contain;
}
.copyright-side-card strong {
  color: var(--template-primary);
  font-family: var(--font-display, Georgia, serif);
  font-size: 16px;
  line-height: 1.12;
}
.copyright-side-card span {
  color: var(--template-primary);
  font-size: 7.6px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}
.copyright-footer,
.thank-you-footer {
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--template-primary);
  font-size: 11px;
  font-weight: 900;
}
.copyright-footer img,
.thank-you-footer img {
  width: 108px;
  max-height: 12px;
  object-fit: contain;
}
.copyright-simple-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 62px 72px 54px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(250,250,247,0.98)),
    #fff !important;
  color: #111;
  text-align: center;
}
.copyright-simple-page .copyright-kicker {
  margin: 0 0 9px;
  color: #595959;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.2em;
  line-height: 1.15;
  text-transform: uppercase;
}
.copyright-simple-page h1 {
  max-width: 390px;
  margin: 0;
  color: #111;
  font-family: var(--font-display, Georgia, serif);
  font-size: var(--copyright-title-size, 42px);
  font-weight: 900;
  line-height: 0.96;
  letter-spacing: 0;
  text-align: center;
  overflow-wrap: anywhere;
}
.copyright-simple-page h2 {
  margin: 8px 0 18px;
  color: #2f2f2f;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.24em;
  line-height: 1.1;
  text-transform: uppercase;
}
.copyright-rule {
  width: 150px;
  height: 1px;
  margin: 0 auto clamp(10px, calc(var(--copyright-title-size, 42px) * 0.42), 20px);
  background: #111;
}
.copyright-simple-page .copyright-publisher {
  margin: 0 0 7px;
  color: #111;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1.1;
  text-transform: uppercase;
}
.copyright-simple-page .copyright-year {
  margin: 0 0 clamp(10px, calc(var(--copyright-title-size, 42px) * 0.38), 18px);
  color: #555;
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.copyright-simple-page .copyright-intro {
  width: 100%;
  max-width: 360px;
  margin: 0 auto clamp(10px, calc(var(--copyright-title-size, 42px) * 0.38), 18px);
  color: #111;
  font-size: 8.8px;
  font-weight: 400;
  line-height: 1.3;
}
.copyright-simple-page .copyright-intro .inline-flow-body,
.copyright-simple-page .copyright-intro .inline-flow-body p {
  margin: 0;
  font: inherit;
  line-height: inherit;
}
.copyright-simple-page .copyright-legal-lines {
  width: 100%;
  max-width: 360px;
  display: grid;
  gap: 5px;
  padding-top: 14px;
  border-top: 1px solid rgba(17,17,17,0.18);
}
.copyright-simple-page .copyright-legal-lines p {
  margin: 0;
  color: #333;
  font-size: 7.8px;
  font-weight: 400;
  line-height: 1.22;
}
.thank-you-body {
  width: 78%;
  margin: 0 auto;
  text-align: center;
}
.thank-you-body p {
  margin: 0 auto 10px;
  color: #1f1f1f;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.28;
}
.thank-you-body p + p::before {
  content: "";
  display: block;
  width: 62px;
  margin: 0 auto 10px;
  border-top: 1px solid var(--template-accent);
}
.thank-you-callout {
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 48px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 82px;
  padding: 12px 16px;
  border: 1px dashed var(--template-primary);
  border-radius: 10px;
  background: color-mix(in srgb, var(--template-primary), white 94%);
}
.callout-art {
  display: grid;
  place-items: center;
  gap: 4px;
}
.callout-art img {
  max-width: 48px;
  max-height: 30px;
  object-fit: contain;
}
.thank-you-callout h3 {
  margin: 0 0 4px;
  color: var(--template-primary);
  font-family: var(--font-display, Georgia, serif);
  font-size: 16px;
  line-height: 1.08;
}
.thank-you-callout p {
  margin: 0 0 4px;
  font-size: 9.2px;
  line-height: 1.24;
}
.thank-you-callout strong {
  color: var(--template-primary);
  font-size: 10.5px;
}
.thank-you-callout strong span {
  color: var(--template-accent);
}
.continuation-page {
  background: #fff !important;
  border-radius: 0;
}
.continuation-body-zone {
  overflow: hidden;
  padding-top: 2px;
}
.continuation-body-zone p {
  color: #1f1f1f;
  font-size: min(var(--body-size, 12px), 10.5px);
  line-height: 1.34;
  text-align: justify;
  white-space: pre-line;
}
.continuation-image-zone {
  border: 0;
  background:
    radial-gradient(circle at 35% 35%, rgba(246,134,52,0.42), transparent 28%),
    linear-gradient(135deg, color-mix(in srgb, var(--template-accent), white 45%), color-mix(in srgb, var(--template-primary), white 62%));
}
.layout-zone h4 {
  margin: 0 0 6px;
  color: var(--template-primary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.layout-zone p,
.layout-zone li {
  margin: 0 0 5px;
  font-size: min(var(--body-size, 11px), 10.5px);
  line-height: min(var(--body-line-height, 1.45), 1.36);
  text-align: var(--body-align, left);
  font-weight: var(--body-weight, 400);
  font-style: var(--body-style, normal);
}
.layout-zone ul {
  margin: 0;
  padding-left: 16px;
}
.recipe-page .title-zone h2 {
  font-size: calc(var(--recipe-title-render-size, 25px) * var(--title-zone-scale, 1));
  line-height: 1.08;
  overflow-wrap: anywhere;
  word-break: normal;
}
.recipe-page .layout-zone h4 {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-bottom: var(--recipe-section-gap, 8px);
  font-size: calc(var(--recipe-body-size, 11px) + 1px);
}
.recipe-page .template-asset-icon {
  width: 15px;
  height: 15px;
  object-fit: contain;
  flex: 0 0 auto;
}
.recipe-meta-icons {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px 6px;
  align-items: center;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.recipe-meta-icons img {
  width: 14px;
  height: 14px;
  object-fit: contain;
  flex: 0 0 14px;
}
.recipe-meta-icons span {
  font-size: 8px;
  font-weight: 800;
  line-height: 1.1;
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
}
.recipe-page .layout-zone p,
.recipe-page .layout-zone li {
  margin-bottom: 4px;
  font-size: min(var(--recipe-body-size, 11px), 10px);
  line-height: min(var(--recipe-line-height, 1.35), 1.3);
}
.recipe-page [data-zone-name="descriptionZone"] p {
  font-size: calc(min(var(--recipe-body-size, 11px), 10px) * var(--description-zone-scale, 1));
  line-height: min(var(--recipe-line-height, 1.35), 1.3);
}
.recipe-page [data-zone-name="titleZone"],
.recipe-page [data-zone-name="descriptionZone"],
.recipe-page [data-zone-name="ingredientsZone"],
.recipe-page [data-zone-name="directionsZone"],
.recipe-page [data-zone-name="tipsZone"] {
  overflow: hidden;
}
.recipe-page [data-zone-name="ingredientsZone"] h4 {
  font-size: calc((var(--recipe-body-size, 11px) + 1px) * var(--ingredients-zone-scale, 1));
}
.recipe-page [data-zone-name="ingredientsZone"] li {
  font-size: calc(min(var(--recipe-body-size, 11px), 10px) * var(--ingredients-zone-scale, 1));
  line-height: min(var(--recipe-line-height, 1.35), 1.3);
}
.recipe-page [data-zone-name="directionsZone"] h4 {
  font-size: calc((var(--recipe-body-size, 11px) + 1px) * var(--directions-zone-scale, 1));
}
.recipe-page .directions-zone .direction-step {
  margin-bottom: 3px;
  font-size: calc(min(calc(var(--recipe-body-size, 11px) - 1px), 8.8px) * var(--directions-zone-scale, 1));
  line-height: 1.18;
}
.direction-step-label {
  display: block;
  margin-bottom: 1px;
  color: color-mix(in srgb, var(--template-primary), #000 16%);
  font-size: calc(7.5px * var(--directions-zone-scale, 1));
  font-weight: 900;
  line-height: 1;
}
.direction-step-text {
  display: block;
  color: color-mix(in srgb, var(--template-muted), #000 12%);
}
.recipe-page .text-zone {
  border-top: 0;
  padding-top: 0;
}
.recipe-page .image-zone {
  transform: scaleY(var(--recipe-image-scale, 1));
  transform-origin: top;
  overflow: hidden;
  background: transparent;
}
.recipe-page.fit-dense .macro-zone p,
.recipe-page.fit-overflow .macro-zone p {
  font-size: 8px;
  line-height: 1.15;
}
.recipe-page.fit-dense .tips-zone,
.recipe-page.fit-overflow .tips-zone {
  padding-left: 5px;
}
.image-zone {
  display: grid;
  place-items: center;
  border: 1px dashed color-mix(in srgb, var(--template-primary), transparent 35%);
  background: linear-gradient(135deg, color-mix(in srgb, var(--template-accent), white 78%), color-mix(in srgb, var(--template-primary), white 82%));
  color: #8a6200;
  font-weight: 900;
}
.selected-slot-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: var(--image-crop-x, 50%) var(--image-crop-y, 50%);
  transform: scale(var(--image-crop-zoom, 1)) rotate(var(--image-crop-rotation, 0deg));
  transform-origin: var(--image-crop-x, 50%) var(--image-crop-y, 50%);
  touch-action: none;
  user-select: none;
}
.selected-slot-image.dragging { cursor: grabbing; }
.image-zone .selected-slot-image { cursor: grab; }
.recipe-page .selected-slot-image {
  object-position: var(--image-crop-x, 50%) var(--image-crop-y, 100%);
}
.recipe-page .image-zone > .selected-slot-image {
  position: absolute;
  right: 0;
  bottom: 0;
  object-fit: cover;
  object-position: var(--image-crop-x, 50%) var(--image-crop-y, 100%);
}
.image-slot-empty {
  display: grid;
  gap: 4px;
  place-items: center;
  padding: 12px;
  color: #8a6200;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
}
.image-slot-empty span {
  color: color-mix(in srgb, var(--template-muted), #000 12%);
  font-size: 9px;
  font-weight: 800;
}
.image-inspector {
  display: grid;
  gap: 12px;
}
.image-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.image-panel-head .section-title {
  margin: 0;
}
.current-image-preview {
  position: relative;
  min-height: 178px;
  overflow: hidden;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(17,17,17,0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(17,17,17,0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(17,17,17,0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(17,17,17,0.035) 75%),
    #faf7ee;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}
.current-image-preview img {
  width: 100%;
  height: 190px;
  display: block;
  object-fit: contain;
}
.image-preview-meta {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  padding: 4px 6px;
  border: 1px solid rgba(255,255,255,0.72);
  border-radius: 8px;
  background: rgba(255,255,255,0.86);
  color: #3d3d3d;
  font-size: 11px;
  font-weight: 800;
  backdrop-filter: blur(8px);
}
.image-preview-meta > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.image-action-grid .btn {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
}
.image-crop-controls {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: #fffaf0;
}
.image-crop-controls h3 {
  margin: 0;
  font-size: 14px;
}
.image-crop-controls .slider-line {
  grid-template-columns: 44px minmax(0, 1fr) 52px;
  gap: 8px;
}
.image-crop-controls input[type="range"] {
  min-width: 0;
  accent-color: var(--brand-yellow);
}
.image-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.image-meta-grid div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: rgba(255,255,255,0.66);
}
.image-meta-grid span {
  display: block;
  margin-bottom: 3px;
  color: var(--brand-muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.image-meta-grid strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--brand-text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.candidate-gallery {
  display: grid;
  gap: 8px;
  max-height: 310px;
  overflow: auto;
  padding-right: 2px;
}
.candidate-gallery h3 {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 4px 0;
  background: color-mix(in srgb, var(--brand-card), transparent 8%);
  font-size: 12px;
  text-transform: uppercase;
}
.library-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.library-search-box svg {
  width: 18px;
  height: 18px;
  color: var(--brand-muted);
  flex: 0 0 auto;
}
.library-search-box .input {
  min-width: 0;
  height: 40px;
  padding: 0 12px;
}
.candidate-image-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.candidate-gallery .candidate-option img,
.candidate-gallery .candidate-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 6px;
}
.macro-zone {
  border-top: 1px solid color-mix(in srgb, var(--template-primary), transparent 70%);
  border-bottom: 1px solid color-mix(in srgb, var(--template-primary), transparent 70%);
  display: flex;
  align-items: center;
  overflow: hidden;
}
.macro-zone p {
  font-size: 9px;
  font-weight: 800;
}
.text-zone {
  border-top: 3px solid var(--template-primary);
  padding-top: 8px;
}
.recipe-section-divider {
  width: 100%;
  height: 9px;
  margin: 0 0 6px;
  border-top: 3px solid var(--template-primary);
}
.recipe-section-divider:has(.recipe-divider-asset-img) {
  border-top: 0;
}
.recipe-divider-asset-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.tips-zone {
  border-left: 0;
  padding-left: 0;
}
.recipe-page [data-zone-name="tipsZone"] h4 {
  font-size: calc((var(--recipe-body-size, 11px) + 1px) * var(--tips-zone-scale, 1));
}
.recipe-page [data-zone-name="tipsZone"] p {
  font-size: calc(8.2px * var(--tips-zone-scale, 1));
  line-height: 1.22;
}
.recipe-page [data-overflow="true"] {
  outline: 1px dashed #f04438;
  outline-offset: 2px;
}
.divider-zone {
  background: repeating-linear-gradient(
    to bottom,
    var(--template-accent),
    var(--template-accent) 4px,
    transparent 4px,
    transparent 9px
  );
  opacity: 0.9;
}
.divider-zone:has(.divider-asset-img) {
  display: grid;
  place-items: center;
  background: transparent;
  opacity: 1;
  overflow: visible;
}
.divider-asset-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.vertical-divider-asset {
  width: 280px;
  max-width: none;
  height: auto;
  transform: rotate(90deg);
  transform-origin: center;
}
.doodle-zone {
  display: grid;
  place-items: center;
  color: var(--template-accent);
  font-size: 24px;
  font-weight: 900;
}
.underline-zone {
  display: grid;
  place-items: center;
  border-top: 0;
  border-radius: 0;
  overflow: visible;
}
.underline-zone:empty {
  border-top: 3px solid var(--template-accent);
  border-radius: 999px;
}
.decorative-image-zone:empty::before {
  content: "";
  width: 100%;
  height: 100%;
  display: block;
  background: linear-gradient(180deg, color-mix(in srgb, var(--template-primary), white 86%), color-mix(in srgb, var(--template-accent), white 84%));
}
.page-number-zone {
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
}
.body-zone p {
  margin: 0 0 10px;
  text-indent: 1.35em;
  white-space: normal;
}
.body-zone h4 {
  margin: 8px 0 4px;
  color: var(--template-primary);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.body-zone ul {
  margin: 0 0 9px 1.2em;
  padding: 0;
}
.body-zone li {
  margin: 0 0 4px;
}
.recipe-page .body-zone p,
.recipe-page .tips-zone p {
  text-indent: 0;
  margin-bottom: 0;
}
.inline-editable {
  display: block;
  max-width: 100%;
  min-width: 0;
  border-radius: 3px;
  outline: 1px dashed transparent;
  cursor: text;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.inline-editable:hover {
  outline-color: color-mix(in srgb, var(--template-accent), transparent 35%);
  background: color-mix(in srgb, var(--template-accent), transparent 90%);
}
.inline-editable:focus {
  outline: 1px dashed var(--template-accent);
  background: rgba(255, 255, 255, 0.56);
}
.inline-page-heading,
.inline-recipe-title {
  white-space: normal;
}
.inline-flow-body {
  min-height: 32px;
  color: inherit;
  font-size: min(var(--body-size, 11px), 10.5px);
  font-style: var(--body-style, normal);
  font-weight: var(--body-weight, 400);
  line-height: min(var(--body-line-height, 1.45), 1.36);
  text-align: var(--body-align, left);
  text-indent: 0;
}
.continuation-body-zone .inline-flow-body {
  color: #1f1f1f;
  line-height: 1.34;
  text-align: justify;
}
.inline-flow-body p {
  margin: 0 0 10px;
  font-size: inherit;
  line-height: inherit;
  text-align: inherit;
  text-indent: 1.35em;
  white-space: normal;
}
.inline-flow-body ul {
  margin: 0 0 10px 1.2em;
  padding: 0;
}
.inline-flow-body li {
  margin: 0 0 4px;
  font-size: inherit;
  line-height: inherit;
  text-indent: 0;
}
.continuation-body-zone .inline-flow-body p {
  text-align: justify;
}
.recipe-page .inline-editable {
  text-indent: 0;
}
.recipe-page .inline-recipe-description,
.recipe-page .inline-recipe-tip {
  font-size: min(var(--recipe-body-size, 11px), 10px);
  line-height: min(var(--recipe-line-height, 1.35), 1.3);
}
.recipe-page .inline-recipe-description {
  font-style: italic;
}
.recipe-page .inline-recipe-tip {
  font-style: italic;
}
.teaser-zone {
  border-top: 1px solid color-mix(in srgb, var(--template-primary), transparent 75%);
  padding-top: 8px;
}
.spread {
  width: 720px;
  height: 480px;
  background: #fffaf0;
  border-radius: 4px 14px 14px 4px;
  box-shadow: 16px 20px 45px rgba(17,17,17,0.18);
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.spread::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, rgba(0,0,0,0.13), transparent 55%, rgba(0,0,0,0.08));
  transform: translateX(-50%);
  z-index: 2;
}
.spread-left {
  background-size: cover;
  background-position: center;
}
.spread-page { padding: 24px 24px 18px 30px; position: relative; }
.selected {
  border: 2px dashed #1685ff;
  border-radius: 8px;
  position: relative;
}
.selected::after {
  content: "";
  width: 12px;
  height: 12px;
  position: absolute;
  bottom: -7px;
  left: 50%;
  background: #1685ff;
  border: 2px solid #fff;
  border-radius: 999px;
}
.hero-food {
  height: 160px;
  margin-bottom: 12px;
}
.recipe-title {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 8px;
}
.recipe-columns { display: grid; grid-template-columns: 1fr 1.2fr; gap: 14px; }
.recipe-box {
  border: 2px dashed #1685ff;
  border-radius: 8px;
  padding: 10px;
  font-size: 10px;
  line-height: 1.55;
}
.recipe-box h4 {
  display: inline-block;
  margin: -20px 0 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #1685ff;
  color: #fff;
}
.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
}

.export-render-body {
  background: #fff;
}
.export-render-body .skip-link {
  display: none;
}
.export-render-body .topbar,
.export-render-body .sidebar {
  display: none;
}
.export-render-body .app-shell {
  display: block;
  min-height: auto;
}
.export-render-body .main {
  display: block;
  padding: 0;
}
.export-document {
  --export-page-width: 816px;
  --export-page-height: 1056px;
  --export-page-logical-height: calc(520px * 11 / 8.5);
  --export-page-scale: 1.5692307692;
  display: block;
  width: max-content;
  margin: 0;
  padding: 0;
  background: #fff;
}
.export-document.export-book-8x10 {
  --export-page-width: 768px;
  --export-page-height: 960px;
  --export-page-logical-height: 650px;
  --export-page-scale: 1.4769230769;
}
.export-document .export-page-shell {
  position: relative;
  width: var(--export-page-width);
  height: var(--export-page-height);
  overflow: hidden;
  background: #fff;
}
.export-document .template-page {
  width: 520px;
  height: var(--export-page-logical-height);
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: scale(var(--export-page-scale));
  transform-origin: top left;
}
.export-document.is-preview-proof .template-page {
  transform: scale(0.82) !important;
  transform-origin: top left;
}
.export-document .layout-zone,
.export-document .image-zone,
.export-document .decorative-image-zone,
.export-document .recipe-box {
  border: 0;
  outline: 0;
  background: transparent;
}
.export-document .zone-label {
  display: none;
}
.export-render-status {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 40px;
  background: #fff;
  color: #111;
  text-align: center;
}
.export-render-status h1 {
  margin: 0;
  font-size: 24px;
}
.export-render-status p {
  max-width: 620px;
  margin: 0;
  color: #555;
}
.export-render-status.error p {
  color: #b42318;
}

@page {
  size: 8.5in 11in;
  margin: 0;
}

@media print {
  .skip-link {
    display: none !important;
  }

  html,
  body {
    margin: 0;
    padding: 0;
    background: #fff;
  }

  * {
    box-sizing: border-box;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .export-render-body .main {
    padding: 0;
  }

  .export-document .export-page-shell {
    break-after: page;
    page-break-after: always;
    overflow: hidden;
  }

  .export-document .export-page-shell:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}

/* Credit disclosure: every wallet-debiting action exposes its server quote. */
.credit-cost-block,
.credit-insufficient {
  display: grid;
  gap: 4px;
  width: 100%;
  margin-top: 10px;
  color: var(--ink, #25231f);
  font-size: 13px;
  line-height: 1.45;
}

.credit-cost-block > span,
.credit-cost-line,
.compact-credit-action > small {
  color: var(--muted, #746f65);
}

.credit-cost-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 8px 0 0;
  font-size: 13px;
}

.credit-cost-line svg {
  width: 15px;
  height: 15px;
}

.credit-cost-line.is-free {
  color: #287653;
}

.credit-insufficient {
  padding: 12px 14px;
  border: 1px solid #d99b37;
  border-radius: 12px;
  background: #fff7df;
}

.credit-insufficient a,
.link-button {
  width: fit-content;
  color: #765000;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.credit-cost-error {
  margin-top: 10px;
  color: #9b2f2f;
  font-size: 13px;
}

.compact-credit-action {
  display: inline-grid;
  gap: 3px;
  justify-items: start;
}

.toc-credit-summary {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.btn .credit-chip {
  flex: 0 0 auto;
}

.credit-confirm-dialog {
  width: min(92vw, 520px);
  padding: 0;
  border: 1px solid var(--border, #ded9cf);
  border-radius: 20px;
  color: var(--ink, #24211c);
  background: var(--surface, #fff);
  box-shadow: 0 24px 80px rgba(36, 33, 28, 0.24);
}

.credit-confirm-dialog::backdrop {
  background: rgba(25, 23, 19, 0.58);
  backdrop-filter: blur(2px);
}

.credit-confirm-card {
  display: grid;
  gap: 20px;
  padding: 28px;
}

.credit-confirm-card h2,
.credit-confirm-copy p {
  margin: 0;
}

.credit-confirm-copy {
  display: grid;
  gap: 10px;
  line-height: 1.55;
}

.credit-confirm-copy strong {
  font-size: 1.08rem;
}

.credit-confirm-copy span {
  color: var(--muted, #6c675e);
}

.credit-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 640px) {
  .btn:has(.credit-chip) {
    min-height: 48px;
    white-space: normal;
    text-align: center;
  }

  .credit-cost-block,
  .credit-insufficient {
    font-size: 12px;
  }

  .credit-confirm-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .credit-confirm-actions .btn {
    width: 100%;
    min-height: 48px;
  }
}
.settings-panel .setting-group {
  padding: 18px 0;
  border-top: 1px solid var(--brand-border);
}
.settings-panel .setting-group:first-child { border-top: 0; padding-top: 0; }
.editor-form {
  display: grid;
  gap: 14px;
}
.editor-field {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 900;
}
.layout-inspector {
  display: grid;
  gap: 14px;
}
.selected-zone-name {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  background: var(--brand-yellow-light);
  color: #111;
  font-weight: 900;
}
.layout-number-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.layout-number-grid .input {
  min-height: 38px;
  padding: 8px 10px;
  color: var(--brand-text);
}
.layout-inspector-actions {
  display: grid;
  gap: 10px;
}
.zone-list {
  display: grid;
  gap: 8px;
}
.zone-list button {
  min-height: 36px;
  border: 1px solid var(--brand-border);
  border-radius: 9px;
  background: #fffefa;
  color: var(--brand-text);
  font-weight: 900;
  text-align: left;
  padding: 0 12px;
}
.zone-list button:hover {
  border-color: var(--warning);
  background: var(--brand-yellow-light);
}
.textarea {
  min-height: 116px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.45;
  color: var(--brand-text);
}
.textarea.compact { min-height: 74px; }
.mono {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  font-weight: 600;
}
.recipe-title-input {
  min-height: 48px;
  font-size: 18px;
  font-weight: 900;
  color: var(--brand-text);
}
.slider-line {
  display: grid;
  grid-template-columns: 110px 1fr 54px;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 800;
}
.slider-line input { accent-color: var(--warning); }
.save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  margin-top: 18px;
  background: rgba(255,253,246,0.95);
  border: 1px solid var(--brand-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.autosave-bar {
  position: static;
  padding: 10px 14px;
}

.system-ok {
  color: var(--success);
  background: var(--success-soft);
  border-radius: 8px;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
}
.muted { color: var(--brand-muted); }
.small { font-size: 12px; font-weight: 700; }
.mt-16 { margin-top: 16px; }
.mt-22 { margin-top: 22px; }
.center { text-align: center; }

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }
  .topbar {
    grid-column: 1;
    padding: 14px 20px;
    gap: 18px;
    flex-wrap: wrap;
  }
  .sidebar {
    grid-column: 1;
    grid-row: 2;
    position: static;
    height: auto;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--brand-border);
  }
  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .nav-list a {
    flex: 0 0 auto;
  }
  .sidebar-bottom {
    display: none;
  }
  .main {
    grid-column: 1;
    grid-row: 3;
    padding: 28px 20px 36px;
  }
  .grid.two,
  .grid.projects,
  .grid.editor,
  .toc-grid,
  .metric-row,
  .template-grid {
    grid-template-columns: 1fr;
  }
  .panel-head,
  .bulk-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .bulk-button-row {
    justify-content: flex-start;
  }
  .bulk-history-open {
    grid-template-columns: minmax(0, 1fr);
  }
  .bulk-history-meta {
    justify-content: flex-start;
  }
  .bulk-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .editor {
    max-width: 100%;
  }
  .editor-toolbar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "info"
      "setup";
    align-items: stretch;
  }
  .editor-subtoolbar {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
  .editor-subtoolbar .editor-mode-tabs,
  .editor-subtoolbar .view-toggle {
    grid-column: 1;
  }
  .book-setup-controls {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }
  .view-toggle {
    width: fit-content;
  }
  .canvas-toolbar {
    justify-content: flex-start;
  }
  .design-controls {
    grid-template-columns: 1fr;
  }
  .text-toolbar {
    flex-wrap: wrap;
  }
  .template-page {
    width: min(480px, 100%);
  }
  .spread {
    width: min(720px, 100%);
    aspect-ratio: 3 / 2;
    height: auto;
  }
  .book-spread {
    width: max-content;
    grid-template-columns: 520px 18px 520px;
  }
  .book-canvas {
    min-height: auto;
    padding: 20px;
  }
  .canvas-stage {
    min-height: 420px;
  }
  .automation-summary {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .automation-summary > div {
    display: grid;
    grid-template-columns: 52px 1fr;
    align-items: center;
    column-gap: 12px;
  }
  .automation-summary .step-icon {
    grid-row: span 2;
    margin: 0;
  }
  .create-progress-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .create-progress-steps span {
    white-space: normal;
  }
  .arrow {
    display: none;
  }
  .project-row,
  .file-row,
  .export-hero,
  .toc-summary,
  .pipeline-card,
  .drive-status {
    grid-template-columns: 1fr;
  }
  .drive-status-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .drive-identity,
  .drive-status-actions {
    flex: 0 1 auto;
    width: 100%;
  }
  .drive-status-actions {
    justify-content: flex-start;
  }
  .drive-quality-flow {
    flex-basis: 100%;
    min-width: 0;
    width: min(100%, 420px);
    grid-template-columns: minmax(0, 1fr);
  }
  .drive-match-cta {
    width: 100%;
  }
  .smart-pairing-dialog-benefits {
    grid-template-columns: 1fr;
  }
  .smart-pairing-dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }
  .smart-pairing-dialog-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .image-coverage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .image-library-actions {
    grid-template-columns: 1fr;
  }
  .image-library-action-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .file-row {
    grid-template-columns: 42px minmax(180px, 1fr) minmax(80px, auto) 132px;
  }
  .file-row .file-metric:nth-of-type(3) {
    grid-column: 2 / 4;
  }
  .file-download,
  .file-unavailable {
    grid-column: 4;
    grid-row: 1 / 3;
  }
  .image-slots-head {
    flex-direction: column;
  }
  .image-slots-scroll {
    min-height: 720px;
    height: 1100px;
    max-height: 1320px;
  }
  .image-slot-row {
    grid-template-columns: 120px minmax(0, 1fr);
  }
  .slot-group-head {
    align-items: flex-start;
  }
  .slot-group-head-actions {
    align-items: flex-end;
    flex-direction: column-reverse;
  }
  .smart-pairing-control.is-running {
    width: min(100%, 460px);
  }
  .smart-pairing-progress.is-compact {
    min-width: min(390px, calc(100vw - 76px));
  }
  .slot-thumb,
  .slot-thumb img,
  .slot-placeholder {
    width: 120px;
    height: 92px;
  }
  .slot-actions {
    grid-column: 1 / -1;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-self: stretch;
  }
  .slot-action-choose,
  .slot-action-generate {
    grid-column: auto;
    grid-row: auto;
  }
  .slot-actions .btn,
  .slot-actions summary.btn {
    min-height: 34px;
  }
  .toolbar-actions,
  .editor-footer,
  .save-bar,
  .searchbar,
  .filterbar {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .bulk-workspace-tabs {
    padding-inline: 8px;
  }
  .bulk-workspace-tabs button {
    flex: 1 1 0;
    justify-content: center;
    padding-inline: 8px;
    font-size: 12px;
  }
  .bulk-workspace-body {
    padding: 12px;
  }
  .bulk-conflict-row {
    align-items: stretch;
    flex-direction: column;
  }
  .bulk-conflict-row .btn {
    width: fit-content;
  }
  .image-coverage-grid {
    grid-template-columns: 1fr;
  }
  .template-assets-head,
  .divider-active-summary {
    grid-template-columns: 1fr;
  }
  .template-assets-head {
    flex-direction: column;
  }
  .asset-group-dividers .asset-icon-grid {
    grid-template-columns: 1fr;
  }
  .image-library-action-buttons {
    grid-template-columns: 1fr;
  }
  .export-files-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .file-row {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px 12px;
  }
  .file-icon {
    width: 34px;
    height: 34px;
  }
  .file-primary,
  .file-metric,
  .file-row .file-metric:nth-of-type(3),
  .file-download,
  .file-unavailable {
    grid-column: 2;
  }
  .file-download,
  .file-unavailable {
    grid-row: auto;
    width: fit-content;
    min-width: 132px;
  }
  .slot-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .candidate-menu {
    position: static;
    width: 100%;
    box-shadow: none;
    margin-top: 8px;
  }
  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }
  .credit-pill {
    padding: 0 12px;
    font-size: 13px;
  }
  .page-title h1 {
    font-size: 30px;
  }
  .field,
  .choice-row,
  .book-setup-controls,
  .recipe-columns,
  .toc-chapter-head,
  .toc-chapter-title,
  .recipe-title-row,
  .slider-line {
    grid-template-columns: 1fr;
  }
  .spread {
    grid-template-columns: 1fr;
  }
  .book-spread {
    grid-template-columns: 1fr;
    gap: 18px;
    filter: none;
  }
  .book-spread .spread-gutter {
    display: none;
  }
  .book-spread .spread-side:not(.active) {
    display: none;
  }
  .spread-left {
    display: none;
  }
  .spread::before {
    display: none;
  }
}

/* Debug 5: BookAutoAI product-family shell and customer surfaces */
:root {
  --bai-ink: #171717;
  --bai-text: #34332f;
  --bai-muted: #6f6f6b;
  --bai-line: #e8e1d1;
  --bai-line-strong: #d8cdb5;
  --bai-paper: #fbfaf5;
  --bai-rail: #fffdf7;
  --bai-surface: #ffffff;
  --bai-yellow: #ffc629;
  --bai-header: #ffd358;
  --bai-yellow-soft: #fff5c8;
  --bai-gold: #9a7300;
  --bai-focus: #e5a900;
  --bai-shadow: 0 12px 34px rgba(54, 43, 15, 0.05);
  --brand-yellow: var(--bai-yellow);
  --brand-yellow-soft: #ffdc67;
  --brand-yellow-light: #fff5c8;
  --brand-cream: var(--bai-paper);
  --brand-paper: #fff9e8;
  --brand-card: var(--bai-surface);
  --brand-border: var(--bai-line);
  --brand-black: var(--bai-ink);
  --brand-text: var(--bai-text);
  --brand-muted: var(--bai-muted);
  --warning: var(--bai-yellow);
  --warning-soft: #fff2bd;
  --shadow: var(--bai-shadow);
}

html {
  min-width: 0;
  background: var(--bai-paper);
  scroll-padding-top: 96px;
}

body {
  min-width: 0;
  overflow-x: clip;
  color: var(--bai-ink);
  background: var(--bai-paper);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
}

body:not(.export-render-body) :where(button, input, select, textarea) {
  font-family: inherit;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 10px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #fff;
  background: var(--bai-ink);
  font-size: 13px;
  font-weight: 800;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell,
.topbar,
.topbar-brand-group,
.topbar-actions,
.sidebar,
.main,
.page,
.page > *,
.grid,
.card,
.panel {
  min-width: 0;
}

.app-shell {
  width: 100%;
  min-height: 100dvh;
  grid-template-columns: 264px minmax(0, 1fr);
  grid-template-rows: 78px minmax(0, 1fr);
  background: var(--bai-paper);
  transition: grid-template-columns 220ms ease;
}

.topbar {
  min-height: 78px;
  padding: 0 34px;
  flex-wrap: nowrap;
  gap: 30px;
  border-bottom: 1px solid rgba(13, 13, 13, 0.12);
  background: var(--bai-header);
  z-index: 60;
}

.topbar-brand-group,
.topbar-actions {
  display: flex;
  align-items: center;
}

.topbar-brand-group {
  gap: 12px;
}

.logo {
  flex: 0 0 auto;
  gap: 11px;
  color: var(--bai-ink);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.logo img {
  width: 46px;
  height: 46px;
  display: block;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.product-context {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding-left: 13px;
  border-left: 1px solid rgba(23, 23, 23, 0.2);
  color: rgba(23, 23, 23, 0.68);
  font-size: 12px;
  font-weight: 750;
}

.topbar-actions {
  width: auto;
  justify-content: flex-end;
  gap: 12px;
  font-weight: 800;
}

.credit-pill,
.header-link {
  min-height: 44px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border: 1px solid rgba(13, 13, 13, 0.15);
  border-radius: 999px;
  color: var(--bai-ink);
  background: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.credit-pill {
  min-width: 142px;
}

.header-link:hover,
.credit-pill:hover {
  background: rgba(255, 255, 255, 0.8);
}

.auth-controls {
  min-width: 44px;
  min-height: 44px;
}

#clerk-user-button {
  width: 39px;
  height: 39px;
}

.auth-loading,
.auth-unavailable {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(23, 23, 23, 0.68);
  font-size: 11px;
  font-weight: 750;
}

.auth-skeleton {
  width: 39px;
  height: 39px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  animation: bai-skeleton 1.4s ease-in-out infinite alternate;
}

@keyframes bai-skeleton {
  to { opacity: 0.55; }
}

.auth-button {
  min-height: 39px;
  border-radius: 999px;
}

.mobile-menu-button {
  display: none;
}

.sidebar-scrim {
  display: none;
}

.sidebar {
  top: 78px;
  grid-column: 1;
  grid-row: 2;
  height: calc(100dvh - 78px);
  min-height: 0;
  padding: 32px 18px 22px;
  overflow-y: auto;
  border-right: 1px solid var(--bai-line);
  background: var(--bai-rail);
  transition: padding 220ms ease, transform 220ms ease;
  z-index: 50;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section-label {
  margin: 0 12px 8px;
  color: #9b8c68;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-section-label-tools {
  margin-top: 18px;
}

.nav-list a {
  min-height: 49px;
  height: auto;
  flex: 0 0 auto;
  gap: 12px;
  padding: 0 13px;
  border-radius: 13px;
  color: #4c4b47;
  font-size: 13px;
  font-weight: 750;
  transition: color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.nav-list a:hover {
  color: var(--bai-ink);
  background: #f5f1e5;
}

.nav-list a.active {
  color: var(--bai-ink);
  background: var(--bai-yellow);
  box-shadow: inset 3px 0 0 #a97900, 0 5px 14px rgba(185, 132, 0, 0.16);
}

.nav-list a:active {
  transform: scale(0.985);
}

.logo:focus-visible,
.topbar-actions a:focus-visible,
.topbar-actions button:focus-visible,
.sidebar a:focus-visible,
.sidebar button:focus-visible,
.main a:focus-visible,
.main button:focus-visible,
.main input:focus-visible,
.main select:focus-visible,
.main textarea:focus-visible {
  outline: 3px solid var(--bai-focus);
  outline-offset: 3px;
}

.sidebar-bottom {
  display: grid;
  gap: 14px;
  margin-top: auto;
  padding-top: 24px;
}

.studio-identity {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e5ae0d;
  border-radius: 16px;
  background: linear-gradient(145deg, #fff5c8 0%, #ffd65f 100%);
}

.studio-identity-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(23, 23, 23, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.studio-identity > span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.studio-identity small {
  color: #775700;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.studio-identity strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px;
}

.back-to-bookautoai {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #7c776c;
  font-size: 12px;
  font-weight: 750;
}

.sidebar-toggle {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--bai-line);
  border-radius: 10px;
  color: #68655d;
  background: #fff;
}

.sidebar-toggle:hover {
  color: var(--bai-ink);
  border-color: #d9b54d;
  background: #fff7da;
}

.main {
  width: 100%;
  max-width: 100%;
  grid-column: 2;
  grid-row: 2;
  padding: 0;
  background-color: var(--bai-paper);
  background-image: radial-gradient(rgba(13, 13, 13, 0.055) 0.7px, transparent 0.7px);
  background-size: 18px 18px;
}

.page {
  width: min(calc(100% - 64px), 1320px);
  max-width: 1320px;
  margin: 0 auto;
  padding: 58px 0 72px;
}

.drive-page {
  max-width: 1680px;
}

.page-header {
  align-items: flex-end;
  gap: 36px;
  margin-bottom: 42px;
}

.page-kicker {
  display: block;
  margin-bottom: 9px;
  color: var(--bai-gold);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title h1,
.tool-hero h1 {
  margin: 0;
  color: var(--bai-ink);
  font-size: clamp(40px, 4.4vw, 64px);
  font-weight: 850;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.page-title p,
.tool-hero p {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--bai-muted);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
}

.card {
  border-color: var(--bai-line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--bai-shadow);
}

.panel {
  padding: 28px;
}

.section-title {
  color: var(--bai-ink);
  font-size: 17px;
  letter-spacing: -0.025em;
}

.btn {
  min-height: 44px;
  padding: 0 17px;
  border-color: var(--bai-line);
  border-radius: 12px;
  color: var(--bai-ink);
  background: #fff;
  font-size: 13px;
  font-weight: 850;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.btn:hover:not(:disabled) {
  border-color: #d8b954;
  background: #fffaf0;
}

.btn.primary {
  min-height: 48px;
  border-color: #d79e00;
  color: var(--bai-ink);
  background: var(--bai-yellow);
  box-shadow: 0 9px 20px rgba(208, 151, 0, 0.18);
}

.btn.primary:hover:not(:disabled) {
  background: #ffd753;
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: scale(0.985);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.72);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #7b5b00;
  font-size: 12px;
  font-weight: 850;
}

.text-link svg {
  width: 15px;
  height: 15px;
}

.metric-row {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 24px;
  overflow: hidden;
  border: 1px solid var(--bai-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--bai-shadow);
}

.metric-row .metric {
  min-height: 96px;
  padding: 20px;
  border: 0;
  border-right: 1px solid var(--bai-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.metric-row .metric:last-child {
  border-right: 0;
}

.metric strong {
  color: var(--bai-ink);
  font-size: 27px;
  font-variant-numeric: tabular-nums;
}

.metric span {
  margin-top: 6px;
  color: var(--bai-muted);
  font-size: 11px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.7fr);
  gap: 18px;
}

.dashboard-active-project {
  min-height: 252px;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 211, 88, 0.19), transparent 40%),
    rgba(255, 255, 255, 0.9);
}

.dashboard-active-project .cover {
  width: 116px;
  height: 154px;
}

.dashboard-active-copy {
  max-width: 590px;
  margin: 20px 0 0;
  color: var(--bai-muted);
  font-size: 13px;
  line-height: 1.55;
}

.dashboard-recent-panel .panel-head {
  margin-bottom: 20px;
}

.dashboard-recent-panel .section-title {
  margin-bottom: 5px;
}

.dashboard-project-list {
  overflow: hidden;
  border: 1px solid var(--bai-line);
  border-radius: 16px;
  background: #fffdf8;
}

.summary-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 14px;
  color: #8f6800;
  background: #fff0b7;
}

.dashboard-credit-card {
  border-color: #e5ae0d;
  background: linear-gradient(145deg, #fff5c8 0%, #ffd65f 100%);
}

.dashboard-credit-card > strong {
  display: block;
  color: var(--bai-ink);
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.dashboard-next-card .section-title {
  margin-top: 20px;
}

.projects-workspace {
  min-width: 0;
}

.projects-page .searchbar {
  align-items: center;
  flex-wrap: wrap;
  padding: 16px;
  border: 1px solid var(--bai-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.searchbar label {
  min-width: min(100%, 280px);
  height: 48px;
  border-radius: 12px;
}

.pill-filter {
  height: 40px;
  color: #5c5a54;
  background: #fffdf8;
}

.pill-filter.active {
  color: var(--bai-ink);
  border-color: #d9a20a;
  background: var(--bai-yellow);
}

.project-list {
  min-width: 0;
}

.project-row {
  min-width: 0;
  padding: 16px 18px;
  border-bottom-color: var(--bai-line);
  background: #fffdf8;
}

.project-row:hover {
  background: #fffaf0;
}

.project-row h3 {
  color: var(--bai-ink);
  font-size: 17px;
}

.tool-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 34px;
  color: var(--bai-muted);
  font-size: 12px;
  font-weight: 750;
}

.tool-back svg {
  width: 15px;
  height: 15px;
}

.tool-hero {
  min-height: 218px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 36px;
  border: 1px solid var(--bai-line);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--bai-shadow);
}

.tool-hero-icon {
  width: 82px;
  height: 82px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 22px;
  color: #8f6800;
  background: #ffd45c;
}

.tool-hero-icon svg {
  width: 34px;
  height: 34px;
}

.tool-hero-copy {
  min-width: 0;
}

.tool-hero-action {
  margin-left: auto;
}

.workflow-notice {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 14px 20px;
  border: 1px solid #e3be4c;
  border-radius: 16px;
  color: #725400;
  background: #fff9df;
}

.workflow-notice > svg {
  flex: 0 0 auto;
}

.workflow-notice > div {
  display: grid;
  gap: 3px;
}

.workflow-notice strong {
  color: #5f4600;
  font-size: 13px;
}

.workflow-notice span {
  font-size: 12px;
  line-height: 1.45;
}

.create-mode-switch {
  width: min(100%, 1080px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 24px;
  padding: 8px;
  border-color: var(--bai-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--bai-shadow);
}

.create-mode-switch button {
  min-width: 0;
  min-height: 72px;
  justify-content: flex-start;
  gap: 14px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--bai-muted);
}

.create-mode-switch button.active {
  border-color: #d99f00;
  color: var(--bai-ink);
  background: #fff6d0;
  box-shadow: inset 4px 0 0 #d99f00;
}

.create-mode-switch button > span {
  min-width: 0;
  display: grid;
  gap: 3px;
  text-align: left;
}

.create-mode-switch button strong,
.create-mode-switch button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.create-mode-switch button strong {
  color: inherit;
  font-size: 13px;
}

.create-mode-switch button small {
  color: var(--bai-muted);
  font-size: 11px;
}

.create-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.72fr);
  align-items: start;
  gap: 22px;
}

.create-form-stack {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.form-card {
  padding: 28px;
}

.form-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--bai-line);
}

.form-section-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #8f6800;
  background: #fff0b7;
}

.form-section-heading h2,
.create-summary-heading h2 {
  margin: 0;
  color: var(--bai-ink);
  font-size: 20px;
  letter-spacing: -0.03em;
}

.form-section-heading p {
  margin: 5px 0 0;
  color: var(--bai-muted);
  font-size: 12px;
  line-height: 1.5;
}

.form-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.field-full {
  grid-column: 1 / -1;
}

.field > .field-label,
.field > span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #4b4943;
  font-size: 12px;
  font-weight: 800;
}

.field-label svg {
  width: 16px;
  height: 16px;
  color: #8c6900;
}

.required-label {
  margin-left: auto;
  padding: 4px 7px;
  border-radius: 999px;
  color: #725500;
  background: #ffec9e;
  font-size: 8px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.input,
.select,
.stepper {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border-color: var(--bai-line-strong);
  border-radius: 12px;
  color: var(--bai-ink);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
}

.input::placeholder,
.textarea::placeholder {
  color: #7b7972;
  opacity: 1;
}

.input:hover,
.select:hover {
  border-color: #cdbd9d;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: #b98500;
  outline: 3px solid rgba(229, 169, 0, 0.22);
}

.library-summary {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 15px;
  border: 1px solid #e4cf8b;
  border-radius: 14px;
  color: #765800;
  background: #fff9e4;
}

.library-summary > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.library-summary strong {
  color: #4f430f;
  font-size: 12px;
}

.library-summary span,
.library-summary a {
  font-size: 11px;
  line-height: 1.4;
}

.library-summary a {
  font-weight: 850;
  white-space: nowrap;
}

.create-summary {
  position: sticky;
  top: 100px;
  display: grid;
  gap: 20px;
  border-color: #e3c66b;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 210, 75, 0.22), transparent 42%),
    #fffdf8;
}

.create-summary-heading {
  display: flex;
  align-items: center;
  gap: 13px;
}

.create-summary-heading .summary-icon {
  flex: 0 0 auto;
  margin: 0;
}

.create-summary-heading .page-kicker {
  margin-bottom: 4px;
}

.create-summary-list {
  display: grid;
  border-top: 1px solid var(--bai-line);
}

.create-summary-list > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--bai-line);
}

.create-summary-list span {
  color: var(--bai-muted);
  font-size: 11px;
}

.create-summary-list strong {
  min-width: 0;
  overflow: hidden;
  color: var(--bai-ink);
  font-size: 12px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.create-summary-empty {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border-radius: 13px;
  color: #735500;
  background: #fff4c9;
}

.create-summary-empty svg {
  flex: 0 0 auto;
}

.create-summary-empty p,
.create-submit-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
}

.create-submit-note {
  color: var(--bai-muted);
  text-align: center;
}

.create-summary .form-message {
  max-width: none;
  margin: 0;
}

.bulk-workspace {
  border-radius: 20px;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 84px minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar {
  padding-inline: 12px;
  overflow-x: hidden;
}

body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-list a span,
body.sidebar-collapsed .studio-identity,
body.sidebar-collapsed .back-to-bookautoai span {
  display: none;
}

body.sidebar-collapsed .nav-list a {
  width: 52px;
  min-height: 52px;
  margin-inline: auto;
  justify-content: center;
  padding: 0;
}

.nav-list a svg,
body.sidebar-collapsed .nav-list a svg {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  margin: 0;
}

body.sidebar-collapsed .nav-list a.active {
  box-shadow: inset 0 -3px 0 #a97900, 0 5px 14px rgba(185, 132, 0, 0.16);
}

body.sidebar-collapsed .sidebar-footer {
  flex-direction: column;
  margin-top: auto;
}

body.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* Keep the image-mode actions inside the narrow Pages rail. Empty projects
   should explain the next step instead of presenting unusable CTA buttons. */
.pages-panel,
.pages-image-actions,
.pages-image-actions > * {
  min-width: 0;
}

@media (min-width: 1181px) {
  .grid.editor {
    grid-template-columns: minmax(290px, 300px) minmax(0, 1fr) minmax(280px, 350px);
  }
  .pages-panel {
    position: sticky;
    top: 96px;
    height: calc(100dvh - 120px);
    max-height: none;
  }
}

.pages-image-actions .btn {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  height: auto;
  padding: 10px 12px;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}

.pages-image-actions .btn svg {
  flex: 0 0 18px;
}

.pages-image-empty-state {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--bai-line);
  border-radius: 12px;
  color: var(--bai-text);
  background: #fbf8ef;
}

.pages-image-empty-state > svg {
  width: 20px;
  height: 20px;
  margin: 2px auto 0;
  color: #8a6808;
}

.pages-image-empty-state > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.pages-image-empty-state strong,
.pages-image-empty-state span {
  overflow-wrap: anywhere;
}

.pages-image-empty-state strong {
  font-size: 12px;
  line-height: 1.3;
}

.pages-image-empty-state span {
  color: var(--bai-muted);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.45;
}

.pages-image-empty-state.is-complete {
  border-color: #bdd9c4;
  background: #f0f8f1;
}

.pages-image-empty-state.is-complete > svg {
  color: #2b7a46;
}

/* Per-slot actions are one compact control group. The global primary CTA is
   intentionally taller, so reset it here to match Editor, Shuffle, and Choose. */
.slot-actions .btn,
.slot-actions summary.btn,
.slot-actions .btn.primary {
  height: 38px;
  min-height: 38px;
  padding: 0 9px;
  border-radius: 10px;
}

.slot-actions .btn.primary {
  box-shadow: none;
}

.slot-actions .smart-pairing-review {
  grid-column: 1 / -1;
  grid-row: 3;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.slot-actions .smart-pairing-review-choice {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 7px;
  height: 46px;
  min-height: 46px;
  padding: 0 13px;
}

.slot-actions .smart-pairing-review-choice.is-yes {
  border-color: #2c8b52;
  background: #e9f8ef;
  color: #176638;
  box-shadow: 0 5px 12px rgba(30, 126, 70, 0.12);
}

.slot-actions .smart-pairing-review-choice.is-yes:hover:not(:disabled) {
  border-color: #217543;
  background: #d9f4e4;
}

.slot-actions .smart-pairing-review-choice.is-no {
  border-color: #c76a5f;
  background: #fff0ed;
  color: #8a2d25;
  box-shadow: 0 5px 12px rgba(159, 54, 43, 0.1);
}

.slot-actions .smart-pairing-review-choice.is-no:hover:not(:disabled) {
  border-color: #ac4c42;
  background: #ffe2dc;
}

.slot-actions .smart-pairing-review-choice.is-selected {
  opacity: 1;
  box-shadow: inset 0 0 0 2px currentColor;
}

.slot-actions .smart-pairing-review-choice.is-review-locked,
.slot-actions .smart-pairing-review-choice:disabled:not(.is-selected):not(.is-loading) {
  opacity: 0.48;
}

.slot-actions .smart-pairing-review-choice.is-error {
  cursor: pointer;
  opacity: 1;
  box-shadow: inset 0 0 0 2px currentColor;
}

.slot-actions .smart-pairing-review-choice.is-loading svg {
  animation: none;
}

.smart-pairing-review-choice > span {
  font-weight: 900;
}

.smart-pairing-review-choice > small {
  justify-self: end;
  font-size: 9px;
  font-weight: 800;
}

.smart-pairing-review-choice.is-yes > small {
  color: #347650;
}

.smart-pairing-review-choice.is-no > small {
  color: #9f4b42;
}

@media (max-width: 1180px) and (min-width: 1025px) {
  .app-shell {
    grid-template-columns: 248px minmax(0, 1fr);
    grid-template-rows: 78px minmax(0, 1fr);
  }

  .topbar {
    grid-column: 1 / -1;
    padding: 0 28px;
  }

  .sidebar {
    position: sticky;
    top: 78px;
    grid-column: 1;
    grid-row: 2;
    height: calc(100dvh - 78px);
    padding: 28px 16px 20px;
    border-right: 1px solid var(--bai-line);
    border-bottom: 0;
  }

  .nav-list {
    width: auto;
    overflow: visible;
  }

  .main {
    grid-column: 2;
    grid-row: 2;
    padding: 0;
  }

  .page {
    width: min(calc(100% - 48px), 1320px);
  }

  .grid.two,
  .grid.projects,
  .metric-row,
  .template-grid {
    grid-template-columns: initial;
  }

  .grid.two {
    grid-template-columns: minmax(0, 1.4fr) minmax(250px, 0.72fr);
  }

  .metric-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .app-shell,
  body.sidebar-collapsed .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 70px minmax(0, 1fr);
  }

  .topbar {
    min-height: 70px;
    grid-column: 1;
    grid-row: 1;
    padding: 0 20px;
  }

  .mobile-menu-button {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(23, 23, 23, 0.16);
    border-radius: 11px;
    color: var(--bai-ink);
    background: rgba(255, 255, 255, 0.5);
  }

  .sidebar {
    position: fixed;
    top: 70px;
    bottom: 0;
    left: 0;
    width: min(320px, calc(100vw - 44px));
    height: auto;
    min-height: 0;
    padding: 26px 18px 22px;
    overflow-y: auto;
    border-right: 1px solid var(--bai-line);
    border-bottom: 0;
    box-shadow: 18px 0 44px rgba(23, 23, 23, 0.14);
    transform: translateX(-105%);
  }

  body.sidebar-open .sidebar,
  .sidebar.is-open {
    transform: translateX(0) !important;
  }

  .nav-list,
  body.sidebar-collapsed .nav-list {
    width: auto;
    flex-direction: column;
    overflow: visible;
  }

  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .nav-list a span,
  body.sidebar-collapsed .studio-identity,
  body.sidebar-collapsed .back-to-bookautoai span {
    display: initial;
  }

  body.sidebar-collapsed .nav-section-label {
    display: block;
  }

  body.sidebar-collapsed .nav-list a {
    justify-content: flex-start;
    padding: 0 13px;
  }

  body.sidebar-collapsed .sidebar-footer {
    flex-direction: row;
  }

  .sidebar-toggle {
    display: none;
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 45;
    inset: 70px 0 0;
    display: block;
    border: 0;
    background: rgba(23, 23, 23, 0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.sidebar-open .sidebar-scrim,
  .sidebar-scrim.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .main {
    grid-column: 1;
    grid-row: 2;
    padding: 0;
  }

  .page {
    width: min(calc(100% - 48px), 1320px);
    padding-top: 42px;
  }

  .grid.two,
  .grid.projects,
  .grid.editor,
  .toc-grid,
  .template-grid,
  .create-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .create-summary {
    position: static;
  }

  .metric-row {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    overflow-x: auto;
  }

  .project-row,
  .file-row,
  .export-hero,
  .toc-summary,
  .pipeline-card,
  .drive-status {
    min-width: 0;
  }
}

@media (max-width: 680px) {
  .topbar {
    padding-inline: 14px;
    gap: 10px;
  }

  .topbar-brand-group {
    gap: 8px;
  }

  .logo img {
    width: 40px;
    height: 40px;
  }

  .logo > span,
  .product-context,
  .header-link span,
  .auth-unavailable span {
    display: none;
  }

  .topbar-actions {
    gap: 7px;
  }

  .credit-pill,
  .header-link {
    min-width: 40px;
    min-height: 40px;
    padding-inline: 10px;
  }

  .credit-pill {
    max-width: 130px;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
  }

  .auth-controls {
    min-height: 40px;
  }

  .auth-button:not(.primary) {
    display: none;
  }

  .auth-button.primary {
    min-height: 38px;
    padding-inline: 11px;
    font-size: 11px;
  }

  .page {
    width: min(calc(100% - 32px), 1320px);
    padding: 32px 0 52px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 22px;
    margin-bottom: 30px;
  }

  .page-title h1,
  .tool-hero h1 {
    font-size: clamp(34px, 12vw, 48px);
  }

  .page-title p,
  .tool-hero p {
    margin-top: 11px;
    font-size: 14px;
    line-height: 1.5;
  }

  .page-primary-action {
    width: 100%;
  }

  .panel,
  .form-card {
    padding: 20px;
    border-radius: 17px;
  }

  .metric-row {
    margin-inline: -16px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .dashboard-active-project {
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: start;
    min-height: 0;
  }

  .dashboard-active-project .cover {
    width: 72px;
    height: 96px;
  }

  .dashboard-active-project .pipeline-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-active-copy,
  .dashboard-active-project .btn {
    grid-column: 1 / -1;
  }

  .project-row {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
  }

  .project-row > :not(.thumb):not(div):not(h3) {
    grid-column: 2;
  }

  .project-row .btn {
    width: 100%;
  }

  .projects-page .searchbar {
    margin-inline: -1px;
    padding: 12px;
  }

  .searchbar label {
    flex-basis: 100%;
  }

  .tool-back {
    margin-bottom: 24px;
  }

  .tool-hero {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
    border-radius: 17px;
  }

  .tool-hero-icon {
    width: 62px;
    height: 62px;
    border-radius: 18px;
  }

  .tool-hero-action {
    width: 100%;
    margin-left: 0;
  }

  .tool-hero-action .btn {
    width: 100%;
  }

  .workflow-notice {
    align-items: flex-start;
    padding: 14px 16px;
  }

  .create-mode-switch {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid-two {
    grid-template-columns: minmax(0, 1fr);
  }

  .field-full {
    grid-column: auto;
  }

  .form-section-heading {
    padding-bottom: 16px;
  }

  .library-summary {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .library-summary a {
    grid-column: 2;
    justify-self: start;
  }

  .create-summary-list > div {
    grid-template-columns: 82px minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell,
  .sidebar,
  .sidebar-scrim,
  .nav-list a,
  .btn,
  .auth-skeleton {
    transition: none;
    animation: none;
  }
}

/* Cookbook Studio onboarding and contextual product tours */
.cookbook-help-control {
  position: relative;
  flex: 0 0 auto;
}

.cookbook-help-control .header-link[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 0 0 5px rgba(168, 112, 0, 0.2);
}

#cookbook-help-popover {
  position: absolute;
  z-index: 800;
  top: calc(100% + 14px);
  right: 0;
  width: min(330px, calc(100vw - 24px));
}

.onboarding-help-popover {
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(17, 17, 17, 0.18);
  border-radius: 18px;
  background: #fffefb;
  box-shadow: 0 24px 65px rgba(17, 17, 17, 0.2);
  color: var(--bai-ink, var(--brand-black));
  padding: 9px;
}

.onboarding-help-popover > button,
.onboarding-help-popover > a,
.onboarding-tour-library button {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 13px;
  color: inherit;
  background: transparent;
  text-align: left;
}

.onboarding-help-popover > button:hover,
.onboarding-help-popover > a:hover,
.onboarding-tour-library button:hover:not(:disabled) {
  background: var(--bai-yellow-soft, var(--brand-yellow-light));
}

.onboarding-help-popover button:disabled {
  opacity: 0.48;
}

.onboarding-help-popover svg {
  width: 21px;
  height: 21px;
}

.onboarding-help-popover span,
.onboarding-tour-library span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.onboarding-help-popover strong,
.onboarding-tour-library strong {
  font-size: 13px;
  font-weight: 900;
}

.onboarding-help-popover small,
.onboarding-tour-library small {
  color: var(--bai-muted, var(--brand-muted));
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

.onboarding-tour-library {
  max-height: min(330px, 45vh);
  overflow-y: auto;
  margin: 2px 4px 8px 38px;
  padding: 5px;
  border-left: 2px solid var(--bai-yellow, var(--brand-yellow));
}

.onboarding-tour-library button {
  min-height: 50px;
  grid-template-columns: minmax(0, 1fr) 18px;
  padding: 7px 9px;
}

.onboarding-auto-tours-toggle {
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  margin: 8px 2px;
  padding: 12px;
  border-block: 1px solid var(--bai-border, var(--brand-border));
}

.onboarding-auto-tours-toggle input {
  width: 21px;
  height: 21px;
  accent-color: #d9a51e;
}

.onboarding-support-links {
  padding-top: 3px;
  border-top: 1px solid rgba(17, 17, 17, 0.12);
}

.onboarding-support-links > a:first-child {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 13px;
  color: inherit;
  text-align: left;
}

.onboarding-support-links > a:first-child:hover {
  background: var(--bai-yellow-soft, var(--brand-yellow-light));
}

.onboarding-support-links .onboarding-support-fallback {
  display: block;
  width: max-content;
  margin: -5px 12px 3px 52px;
  padding: 5px 0;
  border-radius: 5px;
  color: #765900;
  font-size: 11px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.onboarding-support-links .onboarding-support-fallback:hover {
  color: #4f3c00;
}

.onboarding-checklist-card {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px 18px;
  margin-bottom: 22px;
  padding: 22px 24px;
  border-color: rgba(191, 137, 0, 0.38);
  background: linear-gradient(135deg, #fffef8, #fff7d8);
}

.onboarding-checklist-icon {
  grid-row: 1 / span 4;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #6c4b00;
  background: var(--bai-yellow, var(--brand-yellow));
}

.onboarding-checklist-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-right: 30px;
}

.onboarding-checklist-heading h2 {
  margin: 4px 0 0;
  font-size: clamp(18px, 2vw, 24px);
}

.onboarding-checklist-heading > strong {
  white-space: nowrap;
  color: var(--bai-muted, var(--brand-muted));
  font-size: 12px;
}

.onboarding-checklist-close,
.onboarding-dialog-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 25px;
  line-height: 1;
}

.onboarding-checklist-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.onboarding-checklist-close:hover,
.onboarding-dialog-close:hover {
  background: rgba(17, 17, 17, 0.07);
}

.onboarding-checklist-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.1);
}

.onboarding-checklist-progress span {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: #d5a21e;
  transition: width 220ms ease;
}

.onboarding-checklist-card ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.onboarding-checklist-card li {
  min-width: 0;
  padding: 0;
  border: 1px solid rgba(17, 17, 17, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
}

.onboarding-checklist-card li > a {
  min-height: 68px;
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr) 16px;
  align-items: start;
  gap: 9px;
  padding: 10px;
  border-radius: inherit;
}

.onboarding-checklist-card li > a:hover,
.onboarding-checklist-card li > a:focus-visible {
  background: rgba(245, 197, 66, 0.18);
  outline: 2px solid #b98100;
  outline-offset: 2px;
}

.onboarding-checklist-card li > a > svg {
  flex: 0 0 17px;
  width: 17px;
  margin-top: 2px;
}

.onboarding-checklist-card li > a > svg:last-child {
  width: 15px;
  color: #8a6500;
}

.onboarding-checklist-card li.is-complete > a > svg:first-child {
  color: var(--success);
}

.onboarding-checklist-card li span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.onboarding-checklist-card li strong {
  font-size: 12px;
  line-height: 1.4;
}

.onboarding-checklist-card li small {
  color: var(--bai-muted, var(--brand-muted));
  font-size: 10px;
}

.onboarding-checklist-card > .btn {
  justify-self: start;
}

#cookbook-onboarding-dialogs,
#cookbook-onboarding-overlay {
  position: relative;
  z-index: 1000;
}

.onboarding-modal-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 17, 17, 0.58);
  backdrop-filter: blur(4px);
}

.onboarding-welcome-dialog {
  position: relative;
  width: min(610px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 34px;
  border: 1px solid rgba(17, 17, 17, 0.15);
  border-radius: 24px;
  background: #fffefb;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.3);
}

.onboarding-dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.onboarding-welcome-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 17px;
  color: #6b4a00;
  background: var(--bai-yellow, var(--brand-yellow));
}

.onboarding-welcome-mark svg {
  width: 27px;
  height: 27px;
}

.onboarding-welcome-dialog h2 {
  margin: 8px 42px 10px 0;
  font-size: clamp(27px, 5vw, 40px);
  line-height: 1.06;
  letter-spacing: -0.04em;
}

.onboarding-welcome-dialog > p {
  margin: 0;
  color: var(--bai-muted, var(--brand-muted));
  font-size: 15px;
  line-height: 1.65;
}

.onboarding-welcome-choices {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.onboarding-welcome-choices button {
  min-height: 74px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border: 1px solid var(--bai-border, var(--brand-border));
  border-radius: 15px;
  color: inherit;
  background: #fff;
  text-align: left;
}

.onboarding-welcome-choices button.is-primary {
  border-color: #c69100;
  background: var(--bai-yellow-soft, var(--brand-yellow-light));
}

.onboarding-welcome-choices button > span {
  display: grid;
  gap: 3px;
}

.onboarding-welcome-choices strong {
  font-size: 14px;
  font-weight: 900;
}

.onboarding-welcome-choices small {
  color: var(--bai-muted, var(--brand-muted));
  font-size: 11px;
  line-height: 1.4;
}

.onboarding-skip-link {
  display: block;
  margin: 18px auto 0;
  padding: 8px 12px;
  border: 0;
  color: var(--bai-muted, var(--brand-muted));
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  text-decoration: underline;
}

.onboarding-tour-blockers {
  position: fixed;
  z-index: 1001;
  inset: 0;
  pointer-events: none;
}

.onboarding-tour-blockers span {
  position: fixed;
  background: rgba(17, 17, 17, 0.64);
  pointer-events: auto;
}

.onboarding-target-ring {
  position: fixed;
  z-index: 1002;
  border: 3px solid #ffd85a;
  border-radius: 14px;
  box-shadow: 0 0 0 4px rgba(255, 216, 90, 0.3), 0 15px 45px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.onboarding-coachmark {
  position: fixed;
  z-index: 1003;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid rgba(17, 17, 17, 0.18);
  border-radius: 17px;
  color: var(--bai-ink, var(--brand-black));
  background: #fffefb;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.onboarding-coachmark-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #8a6500;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.onboarding-coachmark-head button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: inherit;
  background: rgba(17, 17, 17, 0.06);
  font-size: 22px;
}

.onboarding-coachmark h2 {
  margin: 13px 0 8px;
  font-size: 21px;
  line-height: 1.16;
  letter-spacing: -0.025em;
}

.onboarding-coachmark p {
  margin: 0;
  color: var(--bai-muted, var(--brand-muted));
  font-size: 13px;
  line-height: 1.55;
}

.onboarding-coachmark-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
}

.onboarding-primary-button,
.onboarding-secondary-button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 900;
}

.onboarding-primary-button {
  border: 1px solid #b98100;
  color: #171717;
  background: var(--bai-yellow, var(--brand-yellow));
}

.onboarding-secondary-button {
  border: 1px solid var(--bai-border, var(--brand-border));
  color: inherit;
  background: #fff;
}

@media (max-width: 900px) {
  .onboarding-checklist-card ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  #cookbook-help-popover {
    position: fixed;
    top: 68px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .onboarding-checklist-card {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 18px;
  }

  .onboarding-checklist-icon {
    width: 40px;
    height: 40px;
  }

  .onboarding-checklist-card ol {
    grid-template-columns: minmax(0, 1fr);
  }

  .onboarding-welcome-dialog {
    padding: 26px 20px;
    border-radius: 19px;
  }

  .onboarding-coachmark {
    max-height: min(50vh, 390px);
    border-radius: 17px;
  }

  .onboarding-coachmark-actions button,
  .onboarding-welcome-choices button,
  .onboarding-help-popover > button,
  .onboarding-help-popover > a,
  .onboarding-support-links > a:first-child {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .onboarding-checklist-progress span,
  .onboarding-coachmark,
  .onboarding-target-ring,
  .onboarding-modal-backdrop {
    scroll-behavior: auto;
    transition: none;
    animation: none;
  }
}
