:root {
  color-scheme: light;
  --shell-margin: clamp(14px, 2.5vh, 24px);
  --paper: rgba(255, 243, 246, 0.94);
  --ink: #552537;
  --muted: #946979;
  --accent: #d2688a;
  --accent-dark: #ad4265;
  --line: rgba(85, 37, 55, 0.12);
  --shadow: 0 24px 80px rgba(131, 64, 92, 0.18);
  --bg-a: rgba(210, 104, 138, 0.22);
  --bg-b: rgba(255, 190, 176, 0.22);
  --bg-c1: #fde6ef;
  --bg-c2: #fff7f1;
  --bg-c3: #f7dce7;
  --panel-border: rgba(255, 255, 255, 0.45);
  --surface-soft: rgba(255, 255, 255, 0.62);
  --surface-softer: rgba(255, 255, 255, 0.45);
  --surface-input: rgba(255, 255, 255, 0.78);
  --ghost-bg: rgba(85, 37, 55, 0.08);
  --ghost-ink: var(--ink);
  --loading-ink: #8a6640;
  --loading-bg: rgba(241, 210, 165, 0.34);
  --success-ink: #9a3f62;
  --success-bg: rgba(235, 183, 202, 0.3);
  --error-ink: #9a4437;
  --error-bg: rgba(223, 155, 138, 0.24);
  --badge-ok-bg: rgba(235, 183, 202, 0.3);
  --badge-ok-ink: #9a3f62;
  --badge-warning-bg: rgba(223, 155, 138, 0.24);
  --badge-warning-ink: #9a4437;
  --warning-border: rgba(223, 155, 138, 0.28);
  --warning-bg: rgba(255, 244, 241, 0.92);
  --active-bg: rgba(255, 230, 239, 0.9);
  --active-border: rgba(210, 104, 138, 0.42);
}

:root[data-theme="light-sand"] {
  --paper: rgba(247, 238, 220, 0.95);
  --ink: #432b1a;
  --muted: #816853;
  --accent: #a86a3a;
  --accent-dark: #7f4320;
  --line: rgba(67, 43, 26, 0.12);
  --shadow: 0 24px 80px rgba(98, 67, 38, 0.17);
  --bg-a: rgba(168, 106, 58, 0.2);
  --bg-b: rgba(132, 39, 30, 0.14);
  --bg-c1: #ead7b1;
  --bg-c2: #faf1df;
  --bg-c3: #d8bf92;
  --ghost-bg: rgba(67, 43, 26, 0.08);
  --loading-ink: #70591f;
  --loading-bg: rgba(226, 201, 123, 0.34);
  --success-ink: #66613b;
  --success-bg: rgba(203, 192, 134, 0.26);
  --error-ink: #8e4032;
  --error-bg: rgba(203, 123, 95, 0.2);
  --badge-ok-bg: rgba(203, 192, 134, 0.26);
  --badge-ok-ink: #66613b;
  --badge-warning-bg: rgba(203, 123, 95, 0.2);
  --badge-warning-ink: #8e4032;
  --warning-border: rgba(203, 123, 95, 0.24);
  --warning-bg: rgba(255, 246, 231, 0.93);
  --active-bg: rgba(244, 225, 193, 0.92);
  --active-border: rgba(168, 106, 58, 0.42);
}

:root[data-theme="light-ink"] {
  --paper: rgba(236, 241, 245, 0.95);
  --ink: #223140;
  --muted: #647181;
  --accent: #4b647d;
  --accent-dark: #28384d;
  --line: rgba(34, 49, 64, 0.12);
  --shadow: 0 24px 80px rgba(28, 41, 57, 0.22);
  --bg-a: rgba(72, 96, 120, 0.28);
  --bg-b: rgba(182, 146, 78, 0.18);
  --bg-c1: #cfd8e1;
  --bg-c2: #eef2f5;
  --bg-c3: #bcc7d2;
  --ghost-bg: rgba(36, 50, 64, 0.08);
  --loading-ink: #705f22;
  --loading-bg: rgba(223, 199, 117, 0.3);
  --success-ink: #315d69;
  --success-bg: rgba(141, 179, 188, 0.24);
  --error-ink: #7b4c3b;
  --error-bg: rgba(208, 161, 140, 0.22);
  --badge-ok-bg: rgba(141, 179, 188, 0.24);
  --badge-ok-ink: #315d69;
  --badge-warning-bg: rgba(208, 161, 140, 0.22);
  --badge-warning-ink: #7b4c3b;
  --warning-border: rgba(208, 161, 140, 0.24);
  --warning-bg: rgba(248, 243, 236, 0.92);
  --active-bg: rgba(215, 225, 234, 0.94);
  --active-border: rgba(75, 100, 125, 0.44);
}

:root[data-theme="dark-forest"] {
  color-scheme: dark;
  --paper: rgba(17, 23, 21, 0.92);
  --ink: #eff6e7;
  --muted: #b4c2b0;
  --accent: #8fb46d;
  --accent-dark: #5f7e45;
  --line: rgba(239, 246, 231, 0.1);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --bg-a: rgba(143, 180, 109, 0.22);
  --bg-b: rgba(173, 135, 57, 0.14);
  --bg-c1: #08110f;
  --bg-c2: #10211a;
  --bg-c3: #1b2f25;
  --panel-border: rgba(255, 255, 255, 0.08);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --surface-softer: rgba(255, 255, 255, 0.03);
  --surface-input: rgba(255, 255, 255, 0.06);
  --ghost-bg: rgba(239, 246, 231, 0.08);
  --ghost-ink: var(--ink);
  --loading-ink: #e6d38f;
  --loading-bg: rgba(108, 87, 30, 0.36);
  --success-ink: #d8ecb8;
  --success-bg: rgba(57, 92, 48, 0.44);
  --error-ink: #f0b5a4;
  --error-bg: rgba(103, 47, 39, 0.42);
  --badge-ok-bg: rgba(57, 92, 48, 0.44);
  --badge-ok-ink: #d8ecb8;
  --badge-warning-bg: rgba(103, 47, 39, 0.44);
  --badge-warning-ink: #f0b5a4;
  --warning-border: rgba(196, 111, 90, 0.3);
  --warning-bg: rgba(58, 30, 25, 0.72);
  --active-bg: rgba(34, 55, 31, 0.9);
  --active-border: rgba(143, 180, 109, 0.42);
}

:root[data-theme="dark-ember"] {
  color-scheme: dark;
  --paper: rgba(18, 16, 20, 0.94);
  --ink: #f4ede5;
  --muted: #c9b4ab;
  --accent: #c95d4a;
  --accent-dark: #8e2c2f;
  --line: rgba(244, 237, 229, 0.1);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --bg-a: rgba(201, 93, 74, 0.2);
  --bg-b: rgba(99, 24, 34, 0.2);
  --bg-c1: #07080c;
  --bg-c2: #141117;
  --bg-c3: #211318;
  --panel-border: rgba(255, 255, 255, 0.08);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --surface-softer: rgba(255, 255, 255, 0.03);
  --surface-input: rgba(255, 255, 255, 0.06);
  --ghost-bg: rgba(244, 237, 229, 0.08);
  --ghost-ink: var(--ink);
  --loading-ink: #e8d290;
  --loading-bg: rgba(104, 79, 26, 0.34);
  --success-ink: #dccbb0;
  --success-bg: rgba(83, 64, 50, 0.44);
  --error-ink: #efb5a8;
  --error-bg: rgba(120, 35, 42, 0.48);
  --badge-ok-bg: rgba(83, 64, 50, 0.44);
  --badge-ok-ink: #e9dcc3;
  --badge-warning-bg: rgba(120, 35, 42, 0.48);
  --badge-warning-ink: #efb5a8;
  --warning-border: rgba(201, 93, 74, 0.34);
  --warning-bg: rgba(65, 21, 26, 0.76);
  --active-bg: rgba(54, 21, 27, 0.9);
  --active-border: rgba(201, 93, 74, 0.42);
}

:root[data-theme="dark-ocean"] {
  color-scheme: dark;
  --paper: rgba(9, 15, 33, 0.93);
  --ink: #eef7ff;
  --muted: #9eb4db;
  --accent: #49c7ff;
  --accent-dark: #256fe0;
  --line: rgba(238, 247, 255, 0.1);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  --bg-a: rgba(73, 199, 255, 0.24);
  --bg-b: rgba(180, 76, 255, 0.16);
  --bg-c1: #040814;
  --bg-c2: #09142d;
  --bg-c3: #10295a;
  --panel-border: rgba(255, 255, 255, 0.08);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --surface-softer: rgba(255, 255, 255, 0.03);
  --surface-input: rgba(255, 255, 255, 0.06);
  --ghost-bg: rgba(238, 247, 255, 0.08);
  --ghost-ink: var(--ink);
  --loading-ink: #f0df95;
  --loading-bg: rgba(116, 100, 34, 0.34);
  --success-ink: #95f0ff;
  --success-bg: rgba(18, 94, 128, 0.42);
  --error-ink: #ffb2d9;
  --error-bg: rgba(123, 38, 100, 0.46);
  --badge-ok-bg: rgba(18, 94, 128, 0.42);
  --badge-ok-ink: #95f0ff;
  --badge-warning-bg: rgba(123, 38, 100, 0.46);
  --badge-warning-ink: #ffb2d9;
  --warning-border: rgba(196, 113, 198, 0.32);
  --warning-bg: rgba(53, 20, 66, 0.74);
  --active-bg: rgba(17, 52, 99, 0.9);
  --active-border: rgba(73, 199, 255, 0.44);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, var(--bg-a), transparent 28%),
    radial-gradient(circle at bottom right, var(--bg-b), transparent 24%),
    linear-gradient(135deg, var(--bg-c1) 0%, var(--bg-c2) 46%, var(--bg-c3) 100%);
}

.page-shell {
  width: min(1600px, calc(100% - 32px));
  margin: var(--shell-margin) auto;
  display: grid;
  grid-template-columns: 0.86fr 1.14fr;
  gap: 20px;
}

.dashboard-shell {
  align-items: stretch;
}

.dashboard-shell.is-form-open {
  align-items: start;
}

.book-page-shell {
  width: min(1600px, calc(100% - 32px));
  margin: var(--shell-margin) auto;
}

.library-page-shell {
  width: min(1600px, calc(100% - 32px));
  grid-template-columns: 1fr;
}

.library-page-shell .app-panel {
  max-width: 100%;
}

.hero-panel,
.panel {
  backdrop-filter: blur(16px);
  background: var(--paper);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: min(760px, calc(100vh - 48px));
}

.hero-panel h1,
.panel h2,
.stack-form h3,
.subheading h3 {
  font-family: "Source Serif 4", serif;
}

.hero-panel h1 {
  font-size: clamp(2.5rem, 4.8vw, 4.7rem);
  line-height: 0.94;
  margin: 0 0 20px;
  max-width: 11ch;
}

.hero-copy {
  max-width: 34ch;
  color: var(--muted);
  line-height: 1.6;
}

.hero-card {
  padding: 20px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(29, 122, 109, 0.1), rgba(23, 50, 45, 0.04));
  border: 1px solid var(--line);
}

.hero-card-label,
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.73rem;
  color: var(--muted);
}

.hero-card p {
  margin: 10px 0 0;
  font-weight: 500;
}

.dashboard-hero-panel {
  justify-content: flex-start;
  gap: 24px;
}

.profile-hero-panel {
  min-height: auto;
  padding: 28px 32px;
  gap: 12px;
  justify-content: flex-start;
}

.profile-hero-panel h1 {
  margin-bottom: 8px;
  font-size: clamp(2.2rem, 3.8vw, 3.8rem);
  max-width: 9ch;
}

.profile-hero-panel .hero-copy {
  margin: 0;
  max-width: 52ch;
}

.library-hero-panel h1 {
  max-width: none;
}

.library-hero-panel .hero-copy {
  max-width: 64ch;
}

.dashboard-hero-panel.is-copy-centered {
  justify-content: center;
}

.dashboard-hero-panel.is-copy-centered .dashboard-hero-copy {
  margin-block: auto;
}

.dashboard-hero-panel.is-form-open {
  justify-content: flex-start;
}

.dashboard-hero-copy {
  display: grid;
  gap: 18px;
}

.dashboard-hero-form-shell {
  margin-top: 6px;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, var(--surface-soft), var(--surface-softer));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 14px 34px rgba(0, 0, 0, 0.08);
}

.dashboard-form-intro {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.dashboard-form-intro h3 {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: 1.8rem;
  color: var(--ink);
}

.dashboard-form-intro p:last-child {
  margin: 0;
  color: var(--ink);
  opacity: 0.76;
  line-height: 1.6;
}

.dashboard-launch-panel {
  margin-top: 20px;
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--surface-softer);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-launch-panel h3 {
  margin: 8px 0 0;
  font-family: "Source Serif 4", serif;
  font-size: 1.55rem;
}

.dashboard-launch-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
  max-width: 52ch;
}

.app-panel {
  display: grid;
  gap: 20px;
}

.panel {
  padding: 28px;
}

.panel-heading h2 {
  margin: 8px 0 0;
  font-size: 2rem;
}

.panel-copy {
  margin: 12px 0 0;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.65;
}

.auth-grid,
.library-grid,
.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.stack-form,
.detail-card,
.book-item,
.book-summary,
.chapter-card {
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.stack-form {
  display: grid;
  gap: 14px;
}

.stack-form h3,
.subheading h3 {
  margin: 0;
  font-size: 1.4rem;
}

.book-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.composer-panel {
  margin-top: 20px;
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--surface-softer);
}

.composer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.composer-header h3 {
  margin: 8px 0 0;
  font-family: "Source Serif 4", serif;
  font-size: 1.55rem;
}

.book-form-shell.hidden {
  display: none;
}

.composer-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  align-items: center;
}

.composer-actions .secondary-button {
  margin-top: 0;
}

.compact-book-form {
  margin-top: 0;
}

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

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
}

.front-matter-options {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.field-group-label {
  margin: 0;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 700;
}

.checkbox-label input {
  width: auto;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 0.94rem;
}

.field-label-row,
.field-group-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-label-row > span:first-child,
.field-group-label-row > span:first-child,
.checkbox-label span {
  color: var(--ink);
  font-weight: 700;
}

.field-info-toggle {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--accent-dark);
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
}

.field-info-toggle:hover,
.field-info-toggle:focus-visible {
  background: var(--active-bg);
  color: var(--accent);
}

.field-inline-help {
  display: none;
}

.field-info-popover {
  position: fixed;
  z-index: 1500;
  width: min(320px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  box-shadow: 0 18px 40px rgba(18, 42, 38, 0.14);
  backdrop-filter: blur(16px);
  font-size: 0.84rem;
  line-height: 1.55;
}

.field-info-popover.hidden {
  display: none;
}

.field-help {
  color: var(--ink);
  opacity: 0.72;
  font-size: 0.84rem;
  line-height: 1.45;
}

.model-selector-help {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  font-size: 0.88rem;
}

.model-selector-help p {
  margin: 0;
  color: var(--ink);
  opacity: 0.8;
  line-height: 1.5;
}

.model-selector-field {
  align-self: start;
}

.model-selector-note {
  padding-top: 4px;
  color: var(--ink);
  opacity: 0.74;
}

.generation-cost-summary {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--active-border);
  background: var(--active-bg);
}

.generation-cost-summary-body {
  display: grid;
  gap: 8px;
}

.generation-cost-summary-body p {
  margin: 0;
  color: var(--ink);
  opacity: 0.8;
  line-height: 1.55;
}

.generation-cost-summary-total {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 1rem;
}

.book-form label:has(textarea),
.book-form label:last-of-type {
  grid-column: 1 / -1;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.84;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 44px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent-dark) 50%),
    linear-gradient(135deg, var(--accent-dark) 50%, transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0));
  background-position:
    calc(100% - 20px) calc(50% - 2px),
    calc(100% - 14px) calc(50% - 2px),
    0 0;
  background-size:
    6px 6px,
    6px 6px,
    100% 100%;
  background-repeat: no-repeat;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

select option,
select optgroup {
  background: var(--paper);
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--active-border);
  box-shadow: 0 0 0 3px var(--active-border);
}

textarea {
  resize: vertical;
  min-height: 110px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff8f3;
  font-weight: 700;
  cursor: pointer;
}

.book-form button {
  grid-column: 1 / -1;
}

.secondary-button {
  background: var(--ghost-bg);
  color: var(--ghost-ink);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-box {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.status-box.loading {
  color: var(--loading-ink);
  background: var(--loading-bg);
}

.status-box.success {
  color: var(--success-ink);
  background: var(--success-bg);
}

.status-box.error {
  color: var(--error-ink);
  background: var(--error-bg);
}

.global-status-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  font-size: 0.95rem;
  line-height: 1.45;
  font-weight: 700;
}

.global-status-toast.loading {
  color: var(--loading-ink);
  background: var(--loading-bg);
}

.global-status-toast.success {
  color: var(--success-ink);
  background: var(--success-bg);
}

.global-status-toast.error {
  color: var(--error-ink);
  background: var(--error-bg);
}

.theme-switcher {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
}

.theme-control {
  min-width: 220px;
}

.theme-control select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--surface-input);
  color: var(--ink);
}

.hidden {
  display: none;
}

.subheading {
  margin: 22px 0 12px;
}

.books-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  justify-content: stretch;
  gap: 18px;
}

.dashboard-books-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-content: stretch;
}

.library-toolbar {
  margin-top: 20px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: 240px 180px minmax(0, 1fr);
  gap: 14px;
}

.books-counter {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.96rem;
}

.library-control {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.94rem;
}

.library-control select,
.library-control input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--surface-input);
  color: var(--ink);
}

.pagination {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pagination.hidden {
  display: none;
}

.pagination-label {
  margin: 0;
  color: var(--muted);
}

.book-item {
  width: 100%;
  text-align: left;
}

.book-catalog-item {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 16px;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.book-catalog-item.is-clickable {
  cursor: pointer;
}

.book-catalog-item.is-clickable:hover,
.book-catalog-item.is-clickable:focus-visible {
  transform: translateY(-6px);
  border-color: var(--active-border);
  background: var(--active-bg);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.12);
}

.book-catalog-item.is-clickable:focus-visible {
  outline: none;
}

.book-catalog-cover-shell {
  display: grid;
}

.book-catalog-cover {
  position: relative;
  min-height: 340px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at top right, var(--bg-a), transparent 34%),
    linear-gradient(160deg, rgba(17, 22, 31, 0.92), rgba(38, 28, 20, 0.86));
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.14);
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease;
}

.book-catalog-cover.has-image {
  background: #111;
}

.book-catalog-cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 300ms ease;
}

.book-cover-visual {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: inherit;
  border-radius: inherit;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(7, 12, 21, 0.08), rgba(7, 12, 21, 0.44));
}

.book-cover-visual-image,
.book-cover-fallback-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.book-cover-visual-image {
  object-fit: cover;
  display: block;
  transition: transform 300ms ease;
}

.book-cover-fallback-background {
  background:
    radial-gradient(circle at top right, var(--bg-a), transparent 34%),
    linear-gradient(160deg, rgba(17, 22, 31, 0.92), rgba(38, 28, 20, 0.86));
}

.book-cover-visual-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 12, 20, 0.06), rgba(8, 12, 20, 0.16) 34%, rgba(8, 12, 20, 0.62) 100%);
  pointer-events: none;
  z-index: 1;
}

.book-cover-text-stack {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 0.32rem;
  width: min(88%, 28ch);
}

.book-cover-text {
  margin: 0;
  color: #fff8f3;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.55);
  overflow-wrap: anywhere;
  hyphens: auto;
}

.book-cover-text-title {
  font-family: var(--book-cover-title-font, "Source Serif 4", serif);
  font-size: var(--book-cover-title-size, 1.5rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.book-cover-text-subtitle {
  font-family: var(--book-cover-subtitle-font, "Source Serif 4", serif);
  font-size: var(--book-cover-subtitle-size, 0.92rem);
  line-height: 1.28;
  color: var(--book-cover-subtitle-color, #fff8f3);
}

.book-cover-text-author {
  font-family: var(--book-cover-body-font, "Source Serif 4", serif);
  font-size: var(--book-cover-author-size, 0.8rem);
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--book-cover-author-color, #fff8f3);
  font-weight: 700;
}

.book-cover-position-top-left {
  top: 8%;
  left: 6%;
  text-align: left;
}

.book-cover-position-top-center {
  top: 8%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.book-cover-position-top-right {
  top: 8%;
  right: 6%;
  text-align: right;
}

.book-cover-position-center-left {
  top: 50%;
  left: 6%;
  transform: translateY(-50%);
  text-align: left;
}

.book-cover-position-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.book-cover-position-center-right {
  top: 50%;
  right: 6%;
  transform: translateY(-50%);
  text-align: right;
}

.book-cover-position-bottom-left {
  bottom: 22%;
  left: 6%;
  text-align: left;
}

.book-cover-position-bottom-center {
  bottom: 22%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.book-cover-position-bottom-right {
  bottom: 22%;
  right: 6%;
  text-align: right;
}

.book-cover-text-stack.has-cover-items-author.book-cover-position-bottom-left,
.book-cover-text-stack.has-cover-items-author.book-cover-position-bottom-center,
.book-cover-text-stack.has-cover-items-author.book-cover-position-bottom-right {
  bottom: 6%;
}

.book-cover-text-stack.has-cover-items-title-subtitle-author.book-cover-position-bottom-left,
.book-cover-text-stack.has-cover-items-title-subtitle-author.book-cover-position-bottom-center,
.book-cover-text-stack.has-cover-items-title-subtitle-author.book-cover-position-bottom-right {
  bottom: 24%;
}

.book-catalog-item.is-clickable:hover .book-catalog-cover,
.book-catalog-item.is-clickable:focus-visible .book-catalog-cover {
  transform: translateY(-2px);
  box-shadow: 0 28px 50px rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.22);
}

.book-catalog-item.is-clickable:hover .book-catalog-cover-image,
.book-catalog-item.is-clickable:focus-visible .book-catalog-cover-image,
.book-catalog-item.is-clickable:hover .book-cover-visual-image,
.book-catalog-item.is-clickable:focus-visible .book-cover-visual-image {
  transform: scale(1.03);
}

.book-catalog-cover-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px;
  background: transparent;
}

.book-catalog-text-block {
  width: 100%;
  padding: 16px 16px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(10, 14, 24, 0.72), rgba(10, 14, 24, 0.82));
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.26);
}

.book-catalog-cover-overlay h4,
.book-catalog-cover-overlay p,
.book-catalog-kicker {
  margin: 0;
  color: #fff8f3;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.55);
}

.book-catalog-cover .book-catalog-cover-overlay h4 {
  font-family: "Source Serif 4", serif;
  font-size: clamp(1.6rem, 2.5vw, 2.15rem);
  line-height: 0.95;
  text-transform: none;
  letter-spacing: -0.01em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.book-catalog-cover .book-catalog-cover-overlay p {
  margin-top: 10px;
  max-width: 24ch;
  font-size: 0.88rem;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-transform: none;
  color: #fff8f3;
  opacity: 0.96;
  overflow-wrap: anywhere;
}

.book-catalog-kicker {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.96;
}

.book-catalog-meta {
  display: grid;
  gap: 10px;
}

.book-catalog-category {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.book-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.review-badge.ok {
  background: var(--badge-ok-bg);
  color: var(--badge-ok-ink);
}

.review-badge.warning {
  background: var(--badge-warning-bg);
  color: var(--badge-warning-ink);
}

.review-badge.processing {
  background: var(--loading-bg);
  color: var(--loading-ink);
}

button:disabled,
.secondary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.book-item.active {
  border-color: var(--active-border);
  background: var(--active-bg);
}

.book-item h4,
.detail-card h4 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.book-item p,
.detail-card p,
.book-summary p,
.chapter-card p,
.chapter-card pre {
  color: var(--muted);
  line-height: 1.55;
}

.empty-detail {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
}

.detail-card pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Source Serif 4", serif;
  font-size: 0.97rem;
  margin: 0;
}

.book-detail-view {
  margin-top: 22px;
  display: grid;
  gap: 16px;
}

#book-cover-tools.hidden,
#book-illustration-tools.hidden,
#book-marketing-tools.hidden,
#book-revision-tools.hidden,
#book-tools.hidden,
.book-view-tabs.hidden,
.book-detail-view.hidden {
  display: none;
}

.book-view-tabs {
  margin-top: 22px;
  margin-bottom: 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.book-view-tab-button {
  background: var(--surface-soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

.book-view-tab-button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff8f3;
  border-color: transparent;
}

.print-panel {
  margin-top: 22px;
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--surface-softer);
}

.print-cover-preview-panel {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-input), var(--surface-softer));
  display: grid;
  gap: 14px;
  align-content: start;
}

.print-cover-preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.print-cover-preview-header h4 {
  margin: 6px 0 0;
  font-family: "Source Serif 4", serif;
}

.print-cover-preview-surface {
  position: absolute;
  top: 0;
  left: 50%;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
  background: #0f172a;
  transform: translateX(-50%) scale(var(--preview-scale, 1));
  transform-origin: top center;
}

.print-cover-preview-stage {
  position: relative;
  width: min(100%, 360px);
  margin: 0 auto;
}

.print-cover-layout-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.print-cover-controls-panel {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface-input);
  display: grid;
  gap: 14px;
}

.print-cover-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.print-cover-element-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.print-cover-element-group {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-softer);
  display: grid;
  gap: 12px;
  align-content: start;
}

.print-cover-element-group-head {
  display: grid;
  gap: 4px;
}

.print-cover-element-group-head h5 {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: 1rem;
}

.print-cover-element-group label {
  display: grid;
  gap: 8px;
}

.print-cover-controls-grid input[type="color"] {
  width: 100%;
  min-height: 52px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-input);
  cursor: pointer;
}

.print-editorial-summary {
  margin-bottom: 18px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface-input);
}

.print-editorial-summary h4 {
  margin: 0 0 8px;
  font-family: "Source Serif 4", serif;
  font-size: 1.15rem;
}

.visual-suggestions-panel {
  margin-bottom: 18px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-input), var(--surface-softer));
  display: grid;
  gap: 18px;
}

.visual-suggestions-header,
.visual-section-heading,
.illustration-plan-head,
.cover-suggestion-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.visual-suggestions-header h4,
.visual-section-heading h5,
.cover-suggestion-copy h6,
.illustration-plan-card h6,
.visual-empty-state h6 {
  margin: 6px 0 0;
  font-family: "Source Serif 4", serif;
}

.visual-suggestions-note {
  max-width: 42ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.illustration-plan-list {
  display: grid;
  gap: 14px;
}
.cover-workbench-card,
.illustration-plan-card,
.visual-empty-state {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.visual-summary-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  color: var(--accent-dark);
  font-weight: 700;
}

.cover-suggestion-copy p,
.illustration-plan-card p,
.visual-empty-state p {
  color: var(--muted);
  line-height: 1.55;
}

.generated-illustration-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 220px);
  gap: 14px;
  margin-top: 8px;
  align-items: start;
}

.generated-illustration-meta {
  display: grid;
  gap: 10px;
}

.generated-illustration-image {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  object-fit: contain;
  justify-self: end;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.12);
  cursor: zoom-in;
}

.illustration-generation-note {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-input);
}

.illustration-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.illustration-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.illustration-modal.hidden {
  display: none;
}

.illustration-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 24, 0.72);
  backdrop-filter: blur(6px);
}

.illustration-modal-dialog {
  position: relative;
  z-index: 1;
  width: fit-content;
  max-width: min(92vw, 1100px);
  max-height: 90vh;
  display: grid;
  place-items: center;
}

.illustration-modal-image {
  display: block;
  max-width: 100%;
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.34);
  background: rgba(8, 12, 20, 0.96);
}

.illustration-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: rgba(9, 14, 24, 0.78);
  color: #fff8f3;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
}

.illustration-modal-close:hover {
  background: rgba(9, 14, 24, 0.92);
}

.illustration-priority-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.cover-workbench {
  display: grid;
  gap: 14px;
}

.recommended-cover-banner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--active-bg);
  border: 1px solid var(--active-border);
}

.recommended-cover-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--badge-ok-bg);
  color: var(--badge-ok-ink);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cover-suggestion-switcher {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cover-variant-button {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.cover-variant-button.active {
  background: var(--active-bg);
  border-color: var(--active-border);
}

.cover-variant-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--ghost-bg);
  color: var(--ghost-ink);
  font-size: 0.8rem;
  font-weight: 700;
}

.cover-workbench-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  background: var(--active-bg);
  border-color: var(--active-border);
  overflow: hidden;
}

.cover-suggestion-preview {
  min-height: 220px;
  border-radius: 18px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 18px 1fr;
  border: 1px solid var(--line);
}

.cover-preview-spine {
  background: linear-gradient(180deg, var(--accent-dark), var(--accent));
}

.cover-preview-face {
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    radial-gradient(circle at top right, var(--bg-a), transparent 38%),
    linear-gradient(155deg, var(--surface-input), rgba(255, 255, 255, 0.2));
}

.cover-preview-kicker {
  margin: 0 0 auto;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  color: var(--accent-dark);
  font-weight: 700;
}

.cover-preview-face h6,
.illustration-plan-card h6,
.visual-empty-state h6 {
  font-size: 1.1rem;
}

.cover-preview-face h6,
.cover-preview-subtitle {
  margin: 0;
  font-family: "Source Serif 4", serif;
}

.cover-preview-subtitle {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.cover-suggestion-copy {
  min-width: 0;
}

.cover-suggestion-emphasis {
  margin-top: -2px;
  font-size: 0.94rem;
}

.cover-workbench-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cover-generation-panel {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  display: grid;
  gap: 14px;
}

.cover-upload-panel {
  background:
    linear-gradient(180deg, var(--surface-soft), var(--surface-softer));
}

.cover-generation-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cover-generation-header h5,
.generated-cover-meta p {
  margin: 0;
}

.cover-generation-cost {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--ghost-bg);
  color: var(--ghost-ink);
  font-size: 0.84rem;
  font-weight: 700;
}

.generated-cover-card {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.generated-cover-image {
  width: 100%;
  max-width: 320px;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
}

.generated-cover-stage {
  position: relative;
  width: 100%;
  max-width: 320px;
}

.generated-cover-stage .book-cover-visual {
  min-height: 0;
  aspect-ratio: 2 / 3;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
}

.generated-cover-stage .generated-cover-image {
  max-width: none;
  display: block;
}

.generated-cover-overlay {
  position: absolute;
  inset: 0;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  border-radius: 18px;
  background: transparent;
}

.generated-cover-text-block {
  width: 100%;
  padding: 16px 16px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(9, 14, 24, 0.68), rgba(9, 14, 24, 0.82));
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
}

.generated-cover-overlay h6,
.generated-cover-overlay p {
  margin: 0;
  color: #fff8f3;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.55);
}

.generated-cover-stage .generated-cover-overlay h6 {
  font-family: "Source Serif 4", serif;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  line-height: 0.95;
  text-transform: none;
  letter-spacing: -0.01em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.generated-cover-stage .generated-cover-overlay p {
  margin-top: 10px;
  max-width: 24ch;
  font-size: 0.9rem;
  line-height: 1.34;
  letter-spacing: 0.01em;
  text-transform: none;
  color: #fff8f3;
  overflow-wrap: anywhere;
}

.generated-cover-meta {
  display: grid;
  gap: 10px;
}

.generated-cover-catalog {
  display: grid;
  gap: 16px;
}

.generated-cover-catalog-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.generated-cover-catalog-header h6 {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: 1.05rem;
}

.generated-cover-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 230px));
  gap: 14px;
}

.generated-cover-catalog-item {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.generated-cover-catalog-item.latest {
  border-color: var(--active-border);
  background: var(--active-bg);
}

.generated-cover-catalog-thumb-shell {
  position: relative;
  width: min(100%, 190px);
  margin: 0 auto;
}

.generated-cover-catalog-thumb-shell .book-cover-visual {
  aspect-ratio: 2 / 3;
  min-height: 0;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.generated-cover-catalog-thumb {
  display: block;
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.generated-cover-catalog-item p {
  margin: 0;
  font-size: 0.92rem;
}

.generated-cover-catalog-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(9, 14, 24, 0.82);
  color: #fff8f3;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.generated-cover-selected-note {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--badge-ok-bg);
  color: var(--badge-ok-ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.generated-cover-download {
  margin-top: 0;
}

.prompt-panel {
  margin-top: 14px;
}

.prompt-details {
  margin-top: 12px;
}

.prompt-details summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 700;
}

.prompt-details pre {
  margin: 12px 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-input);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--muted);
  font-family: "Source Serif 4", serif;
}

.prompt-panel pre,
#active-cover-prompt {
  margin: 12px 0 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-input);
  color: var(--muted);
  font-family: "Source Serif 4", serif;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.small-button {
  padding: 9px 14px;
  font-size: 0.88rem;
}

.illustration-plan-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.illustration-priority-badge.must {
  background: var(--badge-ok-bg);
  color: var(--badge-ok-ink);
}

.illustration-priority-badge.optional {
  background: var(--ghost-bg);
  color: var(--ghost-ink);
}

.illustration-summary-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.illustration-plan-disclosure {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.illustration-plan-disclosure summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 700;
}

.visual-empty-state {
  text-align: center;
}

.warnings-section {
  display: grid;
  gap: 12px;
}

.warning-card {
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid var(--warning-border);
  background: var(--warning-bg);
}

.warning-card h4 {
  margin: 0 0 8px;
  font-family: "Source Serif 4", serif;
  font-size: 1.15rem;
}

.warning-card p,
.warning-list li {
  color: var(--muted);
  line-height: 1.55;
}

.warning-list {
  margin: 10px 0 0;
  padding-left: 20px;
}

.book-detail-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.book-summary {
  display: grid;
  gap: 20px;
  padding: 20px 24px;
}

.book-summary-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.book-summary-heading {
  display: grid;
  gap: 12px;
}

.book-summary-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.book-summary-header .secondary-button {
  margin-left: auto;
}

.book-summary h3,
.chapter-card h3 {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: 1.45rem;
}

.book-summary p {
  margin: 0;
}

.book-summary .manuscript-block-view {
  display: grid;
  gap: 18px;
}

.book-summary-body {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.book-summary-body.no-cover {
  grid-template-columns: 1fr;
}

.book-summary-content {
  display: grid;
  gap: 18px;
}

.book-summary-subtitle {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 70ch;
  line-height: 1.65;
}

.book-summary-cover {
  position: relative;
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  box-shadow: 0 18px 32px rgba(22, 34, 66, 0.08);
}

.book-summary-cover img {
  display: block;
  width: 100%;
  height: auto;
}

.book-summary-cover .book-cover-visual {
  aspect-ratio: 2 / 3;
  min-height: 320px;
}

.book-summary-cover .book-cover-visual-image {
  height: 100%;
}

.book-summary-cover-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px 16px;
  color: #f7f3eb;
}

.book-summary-cover-copy h3 {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: 1.35rem;
  line-height: 1.1;
  color: inherit;
}

.book-summary-cover-copy p {
  margin: 8px 0 0;
  color: rgba(247, 243, 235, 0.92);
  font-size: 0.95rem;
  line-height: 1.4;
}

.book-summary-highlight {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border-radius: 22px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.book-back-cover-card {
  margin-top: 2px;
}

.book-summary-highlight-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.book-summary-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px 20px;
}

.book-summary-meta-grid p {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  line-height: 1.65;
}

.manuscript-section {
  display: grid;
  gap: 14px;
}

.manuscript-block-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.manuscript-block-header .eyebrow {
  margin: 0;
}

.front-matter-preview {
  display: grid;
  gap: 10px;
}

.front-matter-preview-toggle {
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  display: grid;
  gap: 8px;
  cursor: pointer;
  width: 100%;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.55;
}

.front-matter-preview-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: pre-wrap;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.6;
}

.front-matter-preview-toggle[aria-expanded="true"] .front-matter-preview-text {
  display: none;
}

.front-matter-preview-label {
  color: var(--accent-dark);
  font-size: 0.95rem;
  font-weight: 700;
}

.front-matter-preview-content {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.55;
}

.front-matter-card .manuscript-block-view > pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.55;
}

.chapter-editor-header {
  justify-content: flex-end;
  margin-bottom: 2px;
}

.manuscript-block-view.hidden {
  display: none;
}

.manuscript-block-editor {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.manuscript-block-editor.hidden {
  display: none;
}

.manuscript-revision-panel {
  display: grid;
  gap: 16px;
}

.book-detail-view .manuscript-revision-panel {
  display: none;
}

.manuscript-revision-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.manuscript-revision-header h4,
.manuscript-version-card h4 {
  margin: 6px 0 0;
  font-family: "Source Serif 4", serif;
  font-size: 1.1rem;
}

.manuscript-revision-header p,
.manuscript-version-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.manuscript-revision-form {
  display: grid;
  gap: 14px;
}

.manuscript-revision-form textarea {
  min-height: 110px;
}

.manuscript-versions-list {
  display: grid;
  gap: 12px;
}

.manuscript-version-card {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  display: grid;
  gap: 10px;
}

.manuscript-version-card.active {
  background: var(--active-bg);
  border-color: var(--active-border);
}

.manuscript-version-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.chapter-card {
  display: grid;
  gap: 12px;
}

.chapter-toggle {
  list-style: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
}

.chapter-toggle-main {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.chapter-toggle::-webkit-details-marker {
  display: none;
}

.chapter-toggle p {
  margin: 8px 0 0;
}

.chapter-toggle-label {
  color: var(--accent-dark);
  font-weight: 700;
  white-space: nowrap;
  padding-top: 6px;
}

.chapter-card pre {
  margin: 0;
  padding-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Source Serif 4", serif;
  font-size: 1rem;
}

.chapter-card[open] .manuscript-block-view {
  padding: 20px 22px;
  border-radius: 18px;
  border: 1px solid rgba(24, 24, 24, 0.08);
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(24, 24, 24, 0.08);
}

.chapter-card[open] .manuscript-block-view pre {
  color: #2b211d;
  line-height: 1.72;
  padding-top: 0;
}

.chapter-illustrations-preview {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-input);
}

.chapter-illustrations-label {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.chapter-illustrations-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.chapter-illustrations-list li {
  color: var(--muted);
  line-height: 1.5;
}

.book-open-button {
  margin-top: 12px;
  width: 100%;
}

.book-open-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 999px;
  text-decoration: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff8f3;
  font-weight: 700;
}

.book-catalog-meta .book-open-link {
  width: 100%;
  margin-top: 0;
}

.secondary-link {
  margin-top: 0;
  background: rgba(32, 25, 22, 0.08);
  color: var(--ink);
}

.profile-form {
  margin-top: 0;
}

.editorial-summary-panel {
  display: grid;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.editorial-summary-panel.hidden {
  display: none;
}

.editorial-summary-panel h4 {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: 1.4rem;
}

.editorial-summary-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.editorial-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.editorial-summary-logo {
  display: inline-flex;
  width: fit-content;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-input);
}

.editorial-summary-logo img {
  max-width: 180px;
  max-height: 96px;
  object-fit: contain;
}

.logo-preview {
  display: grid;
  place-items: center;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: var(--surface-input);
}

.logo-preview img,
.editorial-logo-card img {
  max-width: 180px;
  max-height: 96px;
  object-fit: contain;
}

.editorial-logo-card {
  margin-top: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-input);
  display: inline-flex;
}

.toolbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.book-reader-panel {
  min-height: calc(100vh - 48px);
}

.print-preview-body {
  margin: 0;
  background: #e8e6e1;
  color: #111;
  font-family: var(--print-body-font, "Source Serif 4", serif);
}

.print-preview-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: rgba(248, 246, 241, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.print-preview-root {
  padding: 24px;
  display: grid;
  gap: 20px;
  justify-content: center;
}

.print-page {
  width: var(--print-width, 6in);
  min-height: var(--print-height, 9in);
  background: #fff;
  color: #111;
  box-shadow: 0 12px 42px rgba(0, 0, 0, 0.12);
  page-break-after: always;
  break-after: page;
}

.print-page-inner {
  min-height: var(--print-height, 9in);
  padding:
    var(--print-margin-top, 0.75in)
    var(--print-margin-right, 0.65in)
    var(--print-margin-bottom, 0.85in)
    var(--print-margin-left, 0.9in);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.cover-page .print-page-inner {
  justify-content: space-between;
  text-align: center;
}

.print-cover-core {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.print-cover-core h1 {
  margin: 0;
  font-family: var(--print-title-font, "Source Serif 4", serif);
  font-size: 28pt;
  line-height: 1.08;
}

.print-cover-subtitle {
  margin: 0;
  font-family: var(--print-subtitle-font, "Source Serif 4", serif);
  font-size: 14pt;
  line-height: 1.3;
}

.print-editorial-block {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.print-cover-logo {
  max-width: 2.2in;
  max-height: 1.1in;
  object-fit: contain;
}

.print-editorial-name {
  margin: 0;
  font-family: var(--print-title-font, "Source Serif 4", serif);
  font-size: 13pt;
}

.print-editorial-author {
  margin: 0;
  font-family: var(--print-body-font, "Source Serif 4", serif);
  font-size: 11pt;
}

.print-cover-bleed-page .print-page-inner {
  display: block;
  position: relative;
  min-height: var(--print-height, 9in);
  padding: 0;
  overflow: hidden;
  isolation: isolate;
}

.print-cover-full-image,
.print-cover-fallback-background,
.print-cover-overlay {
  position: absolute;
  inset: 0;
}

.print-cover-full-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.print-cover-fallback-background {
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.18), transparent 36%),
    linear-gradient(155deg, #0f172a 0%, #1d4ed8 48%, #08111f 100%);
}

.print-cover-overlay {
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.24) 0%, rgba(0, 0, 0, 0.1) 34%, rgba(0, 0, 0, 0.46) 100%);
}

.print-cover-bleed-page .print-editorial-block,
.print-cover-text-stack {
  position: absolute;
  z-index: 2;
  max-width: calc(100% - 1in);
  color: #fff;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.45);
}

.print-cover-text-stack {
  display: grid;
  gap: 8px;
}

.print-cover-text-stack:has(.print-cover-text-title),
.print-cover-text-stack:has(.print-cover-text-subtitle) {
  min-width: min(100%, 3.9in);
}

.print-cover-text-stack.has-cover-items-title-author,
.print-cover-text-stack.has-cover-items-subtitle-author,
.print-cover-text-stack.has-cover-items-title-subtitle-author {
  gap: 14px;
}

.print-cover-text-stack.has-cover-items-title-subtitle,
.print-cover-text-stack.has-cover-items-title-subtitle-author {
  gap: 18px;
}

.print-cover-text {
  margin: 0;
}

.print-cover-text-title {
  font-family: var(--print-title-font, "Source Serif 4", serif);
  font-size: var(--print-cover-title-size, 32pt);
  color: var(--print-cover-title-color, #fff);
  line-height: 1.05;
  font-weight: 700;
}

.print-cover-text-subtitle {
  font-family: var(--print-subtitle-font, "Source Serif 4", serif);
  font-size: var(--print-cover-subtitle-size, 14pt);
  color: var(--print-cover-subtitle-color, #fff);
  line-height: 1.3;
}

.print-cover-text-author {
  font-family: var(--print-body-font, "Source Serif 4", serif);
  font-size: var(--print-cover-author-size, 12pt);
  color: var(--print-cover-author-color, #fff);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.print-cover-position-bottom-left .print-cover-text-author,
.print-cover-position-bottom-center .print-cover-text-author,
.print-cover-position-bottom-right .print-cover-text-author {
  margin-top: 0.16in;
}

.print-cover-position-top-left {
  top: 0.9in;
  left: 0.32in;
  text-align: left;
}

.print-cover-position-top-center {
  top: 0.9in;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.print-cover-position-top-right {
  top: 0.9in;
  right: 0.32in;
  text-align: right;
}

.print-cover-position-center-left {
  top: 50%;
  left: 0.32in;
  transform: translateY(-50%);
  text-align: left;
}

.print-cover-position-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.print-cover-position-center-right {
  top: 50%;
  right: 0.32in;
  transform: translateY(-50%);
  text-align: right;
}

.print-cover-position-bottom-left {
  bottom: 1.8in;
  left: 0.32in;
  text-align: left;
}

.print-cover-position-bottom-center {
  bottom: 1.8in;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.print-cover-position-bottom-right {
  bottom: 1.8in;
  right: 0.32in;
  text-align: right;
}

.print-cover-text-stack.has-cover-items-author.print-cover-position-bottom-left,
.print-cover-text-stack.has-cover-items-author.print-cover-position-bottom-center,
.print-cover-text-stack.has-cover-items-author.print-cover-position-bottom-right {
  bottom: 0.42in;
}

.print-cover-text-stack.has-cover-items-title.print-cover-position-bottom-left,
.print-cover-text-stack.has-cover-items-title.print-cover-position-bottom-center,
.print-cover-text-stack.has-cover-items-title.print-cover-position-bottom-right,
.print-cover-text-stack.has-cover-items-subtitle.print-cover-position-bottom-left,
.print-cover-text-stack.has-cover-items-subtitle.print-cover-position-bottom-center,
.print-cover-text-stack.has-cover-items-subtitle.print-cover-position-bottom-right,
.print-cover-text-stack.has-cover-items-title-subtitle.print-cover-position-bottom-left,
.print-cover-text-stack.has-cover-items-title-subtitle.print-cover-position-bottom-center,
.print-cover-text-stack.has-cover-items-title-subtitle.print-cover-position-bottom-right,
.print-cover-text-stack.has-cover-items-title-subtitle-author.print-cover-position-bottom-left,
.print-cover-text-stack.has-cover-items-title-subtitle-author.print-cover-position-bottom-center,
.print-cover-text-stack.has-cover-items-title-subtitle-author.print-cover-position-bottom-right {
  bottom: 2.2in;
}

.print-cover-bleed-page .print-editorial-block {
  gap: 8px;
  justify-items: center;
}

.print-cover-bleed-page .print-editorial-top {
  top: 0.6in;
  left: 50%;
  transform: translateX(-50%);
}

.print-cover-bleed-page .print-editorial-center-below-title {
  top: 68%;
  left: 50%;
  transform: translateX(-50%);
}

.print-cover-bleed-page .print-editorial-bottom {
  bottom: 0.6in;
  left: 50%;
  transform: translateX(-50%);
}

.print-cover-bleed-page .print-cover-logo {
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.32));
}

.chapter-page .print-page-inner {
  display: block;
}

.dedication-page .print-page-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--print-height, 9in) - var(--print-margin-top, 0.75in) - var(--print-margin-bottom, 0.85in));
}

.print-dedication-content {
  width: min(100%, 4.6in);
  text-align: center;
}

.print-dedication-text {
  margin: 0 0 0.85em;
  font-family: var(--print-subtitle-font, "Source Serif 4", serif);
  font-size: calc(var(--print-font-size, 11pt) + 1pt);
  line-height: 1.6;
  font-style: italic;
}

.print-dedication-text:last-child {
  margin-bottom: 0;
}

.print-chapter-header {
  margin-bottom: 24px;
  text-align: center;
}

.print-chapter-header h2 {
  margin: 0;
  font-family: var(--print-title-font, "Source Serif 4", serif);
  font-size: 20pt;
  line-height: 1.2;
}

.print-chapter-content {
  font-family: var(--print-body-font, "Source Serif 4", serif);
  font-size: var(--print-font-size, 11pt);
  line-height: var(--print-line-height, 1.45);
}

.print-chapter-content p,
.print-inline-heading {
  margin: 0 0 0.6em;
}

.print-inline-heading {
  font-family: var(--print-subtitle-font, "Source Serif 4", serif);
  font-size: calc(var(--print-font-size, 11pt) + 2pt);
  font-weight: 600;
}

.print-spacer {
  height: 0.35em;
}

.illustration-page .print-page-inner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.illustration-frame {
  width: 100%;
  min-height: calc(var(--print-height, 9in) - var(--print-margin-top, 0.75in) - var(--print-margin-bottom, 0.85in));
  display: flex;
  align-items: center;
  justify-content: center;
}

.illustration-box {
  border: 1px solid rgba(0, 0, 0, 0.35);
  width: 100%;
  min-height: 4.5in;
}

.illustration-rendered-image {
  display: block;
  max-width: 100%;
  max-height: calc(var(--print-height, 9in) - var(--print-margin-top, 0.75in) - var(--print-margin-bottom, 0.85in));
  object-fit: contain;
}

@page {
  size: var(--print-width, 6in) var(--print-height, 9in);
  margin: 0;
}

@media print {
  body.print-preview-body {
    background: #fff;
  }

  .no-print {
    display: none !important;
  }

  .print-preview-root {
    padding: 0;
    gap: 0;
  }

  .print-page {
    box-shadow: none;
    margin: 0;
  }
}

.auth-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 24px;
}

.auth-card {
  max-width: none;
  min-height: 100%;
  padding: 28px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.24), transparent 28%),
    linear-gradient(180deg, var(--surface-soft), var(--surface-softer));
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 18px 40px rgba(18, 42, 38, 0.08);
}

.auth-switch-copy {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-card-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.auth-actions-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.text-button {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.text-button:hover,
.text-button:focus-visible {
  color: var(--accent);
}

.text-link {
  color: var(--accent-dark);
  font-weight: 700;
  text-underline-offset: 0.16em;
}

@media (max-height: 900px) {
  .page-shell {
    gap: 16px;
  }

  .hero-panel {
    padding: 24px;
    min-height: min(680px, calc(100vh - 40px));
  }

  .panel {
    padding: 22px;
  }

  .panel-heading h2 {
    font-size: 1.7rem;
  }

  .dashboard-launch-panel {
    margin-top: 12px;
    padding: 16px;
  }

  .dashboard-launch-panel h3 {
    font-size: 1.35rem;
  }

  .books-list {
    gap: 14px;
  }

  .book-catalog-cover {
    min-height: 280px;
  }
}

@media (max-height: 820px) {
  :root {
    --shell-margin: 12px;
  }

  .page-shell {
    gap: 12px;
  }

  .hero-panel {
    padding: 20px;
    min-height: min(600px, calc(100vh - 32px));
  }

  .hero-panel h1 {
    font-size: clamp(2.1rem, 4.2vw, 3.8rem);
  }

  .panel {
    padding: 18px;
  }

  .panel-heading h2 {
    margin-top: 6px;
    font-size: 1.5rem;
  }

  .dashboard-launch-panel {
    margin-top: 10px;
    padding: 14px;
  }

  .dashboard-launch-panel h3 {
    font-size: 1.25rem;
  }

  .dashboard-launch-copy {
    margin-top: 8px;
  }

  .books-list {
    gap: 12px;
  }

  .book-catalog-item {
    padding: 12px;
  }

  .book-catalog-cover {
    min-height: clamp(220px, 28vh, 260px);
  }
}

@media (max-width: 1040px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: auto;
  }
}

@media (max-width: 1440px) {
  .books-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .books-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1280px);
    margin: 10px auto;
  }

  .panel,
  .hero-panel {
    padding: 20px;
    border-radius: 22px;
  }

  .auth-grid,
  .library-grid,
  .profile-grid,
  .book-form {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 22px;
  }

  .composer-header,
  .composer-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-launch-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-hero-form-shell {
    padding: 18px;
  }

  .library-toolbar {
    grid-template-columns: 1fr;
  }

  .print-cover-layout-grid,
  .print-cover-controls-grid,
  .print-cover-element-groups {
    grid-template-columns: 1fr;
  }

  .illustration-plan-list,
  .cover-workbench-card {
    grid-template-columns: 1fr;
  }

  .visual-suggestions-header,
  .visual-section-heading,
  .illustration-plan-head,
  .cover-suggestion-topline,
  .cover-generation-header {
    flex-direction: column;
  }

  .cover-suggestion-preview {
    min-height: 180px;
  }

  .generated-cover-card {
    grid-template-columns: 1fr;
  }

  .generated-illustration-card {
    grid-template-columns: 1fr;
  }

  .generated-illustration-image {
    max-width: 100%;
  }

  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .global-status-toast {
    right: 16px;
    left: 16px;
    top: 16px;
  }

  .toolbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .editorial-summary-head {
    flex-direction: column;
  }

  .book-summary-header {
    flex-direction: column;
  }

  .book-summary-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .book-summary-body {
    grid-template-columns: 1fr;
  }

  .manuscript-revision-header,
  .manuscript-version-head,
  .manuscript-block-header {
    flex-direction: column;
  }

  .book-item-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .books-list {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-books-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .books-list {
    grid-template-columns: 1fr;
  }

  .dashboard-books-list {
    grid-template-columns: 1fr;
  }
}
