/* ============================================
   KDP Fácil da Dani — Sistema de design
   Inspiração: editora boutique, encadernação,
   papel, dourado tipográfico, marca-páginas.
   ============================================ */

/* ---------- Tokens ---------- */
:root {
  /* Cores — papel, tinta, encadernação */
  --paper: #FCFAF7;
  --paper-warm: #F5EFE3;
  --paper-soft: #FAF5EA;
  --surface: #FFFFFF;
  --ink: #1A1A1A;
  --ink-soft: #5A554F;
  --ink-faint: #9B9590;
  --ink-ghost: #C8C2B8;
  --rule: #E5DDD0;
  --rule-soft: #EFEADD;

  /* Cores de identidade */
  --bind: #2D5F4E;          /* verde encadernação — primário */
  --bind-deep: #1F4438;
  --bind-soft: #E8F0EC;
  --gold: #C9A961;          /* dourado tipográfico */
  --gold-soft: #F4ECD8;
  --marca: #B8410E;         /* marca-página (alertas) */
  --marca-soft: #FBE8DC;
  --success: #5F8246;
  --success-soft: #E8EFDE;

  /* Tipografia */
  --font-display: 'Fraunces', 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Escala tipográfica */
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.75rem;
  --fs-4xl: 3.75rem;

  /* Espaçamento */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --sp-9: 6rem;

  /* Bordas e sombras */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(26, 26, 26, 0.04), 0 1px 3px rgba(26, 26, 26, 0.06);
  --shadow: 0 2px 6px rgba(26, 26, 26, 0.06), 0 8px 24px rgba(26, 26, 26, 0.08);
  --shadow-book: 2px 0 4px rgba(0, 0, 0, 0.15), 6px 0 24px rgba(0, 0, 0, 0.18);

  /* Layout */
  --header-h: 68px;
  --container-w: 1180px;
  --container-pad: clamp(1rem, 4vw, 2.25rem);

  /* Motion */
  --ease: cubic-bezier(0.4, 0.0, 0.2, 1);
  --ease-out: cubic-bezier(0.0, 0.0, 0.2, 1);
  --t-fast: 140ms;
  --t-base: 220ms;
  --t-slow: 380ms;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Reset suave ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Fundo com textura sutil de papel */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(rgba(26, 26, 26, 0.012) 1px, transparent 1px),
    radial-gradient(rgba(26, 26, 26, 0.008) 1px, transparent 1px);
  background-size: 32px 32px, 64px 64px;
  background-position: 0 0, 16px 16px;
  pointer-events: none;
  z-index: 0;
}

main, header, footer { position: relative; z-index: 1; }

img, svg { max-width: 100%; height: auto; display: block; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--bind); text-decoration: none; }
a:hover { color: var(--bind-deep); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

.font-mono { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); }

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(252, 250, 247, 0.94);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.app-header__inner {
  height: 100%;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 var(--container-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
}
.brand__name { display: flex; flex-direction: column; line-height: 1.05; }
.brand__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-lg);
  font-variation-settings: 'opsz' 36, 'SOFT' 50;
  letter-spacing: -0.01em;
}
.brand__sub {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 0.78rem;
  color: var(--bind);
  margin-top: -2px;
  letter-spacing: 0.02em;
}

.app-nav { display: flex; gap: var(--sp-5); align-items: center; }
.app-nav__link {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  font-weight: 500;
  position: relative;
  padding: 6px 2px;
}
.app-nav__link:hover, .app-nav__link.is-active {
  color: var(--ink);
  text-decoration: none;
}
.app-nav__link.is-active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--gold);
}

#menuToggle { display: none; }

/* ---------- Main ---------- */
.app-main {
  flex: 1;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: var(--sp-6) var(--container-pad) var(--sp-8);
  width: 100%;
}

/* ---------- Footer ---------- */
.app-footer {
  border-top: 1px solid var(--rule);
  padding: var(--sp-5) var(--container-pad);
  text-align: center;
  color: var(--ink-faint);
  font-size: var(--fs-xs);
  background: var(--paper-soft);
}
.app-footer a { color: var(--ink-soft); }

/* ---------- Tipografia ---------- */
.h1, h1 {
  font-family: var(--font-display);
  font-weight: 350;
  font-size: clamp(2rem, 5.5vw, var(--fs-3xl));
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-variation-settings: 'opsz' 144, 'SOFT' 30;
  margin: 0;
}
.h2, h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 3.5vw, var(--fs-2xl));
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-variation-settings: 'opsz' 72, 'SOFT' 40;
  margin: 0;
}
.h3, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-xl);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0;
}
.h4, h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-lg);
  letter-spacing: -0.005em;
  margin: 0;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bind);
  font-weight: 500;
}
.lead {
  font-size: var(--fs-md);
  color: var(--ink-soft);
  line-height: 1.6;
  max-width: 56ch;
}
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 11px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  font-size: var(--fs-sm);
  letter-spacing: 0.005em;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--bind);
  color: var(--paper);
  border-color: var(--bind);
}
.btn--primary:hover {
  background: var(--bind-deep);
  border-color: var(--bind-deep);
  color: var(--paper);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(45, 95, 78, 0.25);
}

.btn--secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--rule);
}
.btn--secondary:hover {
  background: var(--paper-warm);
  border-color: var(--ink-faint);
  color: var(--ink);
}

.btn--ghost { color: var(--ink-soft); }
.btn--ghost:hover { color: var(--ink); background: var(--paper-warm); }

.btn--gold {
  background: linear-gradient(180deg, var(--gold), #b89548);
  color: var(--ink);
  border-color: #a8862e;
  font-weight: 600;
}
.btn--gold:hover {
  background: linear-gradient(180deg, #d4b56b, #a8862e);
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(201, 169, 97, 0.35);
}

.btn--danger { color: var(--marca); }
.btn--danger:hover { background: var(--marca-soft); color: var(--marca); }

.btn--lg { padding: 14px 28px; font-size: var(--fs-base); }
.btn--sm { padding: 7px 14px; font-size: var(--fs-xs); }
.btn--block { width: 100%; }

.btn--icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
}
.btn--icon:hover { background: var(--paper-warm); color: var(--ink); }

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.card--soft { background: var(--paper-warm); border-color: var(--rule-soft); }
.card--accent {
  background: var(--bind-soft);
  border-color: rgba(45, 95, 78, 0.18);
}
.card--gold {
  background: var(--gold-soft);
  border-color: rgba(201, 169, 97, 0.3);
}
.card--alert {
  background: var(--marca-soft);
  border-color: rgba(184, 65, 14, 0.18);
}
.card--hoverable:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow);
}

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.field__label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink);
}
.field__label .req { color: var(--marca); margin-left: 2px; }
.field__hint {
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  line-height: 1.45;
}
.field__error {
  font-size: var(--fs-xs);
  color: var(--marca);
  font-weight: 500;
}
.input, .textarea, .select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-base);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--bind);
  box-shadow: 0 0 0 3px var(--bind-soft);
}
.textarea {
  min-height: 220px;
  resize: vertical;
  font-family: var(--font-body);
  line-height: 1.6;
}
.textarea--book {
  min-height: 360px;
  font-family: var(--font-display);
  font-size: var(--fs-md);
  line-height: 1.7;
  font-variation-settings: 'opsz' 14;
  background: var(--paper-soft);
}

/* ---------- Dashboard / Estante de livros ---------- */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--sp-7);
}
.dashboard__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--sp-5);
  flex-wrap: wrap;
}
.dashboard__title-block .eyebrow { margin-bottom: var(--sp-2); display: block; }

/* Estante de livros */
.shelf {
  position: relative;
  padding: var(--sp-7) var(--sp-5) 0;
  min-height: 380px;
}
.shelf__plank {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 22px;
  background: linear-gradient(180deg, #8b6f4d 0%, #6b5236 50%, #4f3b22 100%);
  border-radius: 2px;
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.shelf__plank::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: -3px;
  height: 3px;
  background: rgba(0, 0, 0, 0.18);
  filter: blur(2px);
}
.shelf__books {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 320px;
  padding-bottom: 22px;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
}

.book {
  position: relative;
  width: var(--book-w, 64px);
  height: var(--book-h, 280px);
  border-radius: 2px 4px 4px 2px;
  cursor: pointer;
  background: var(--book-color, #2D5F4E);
  box-shadow:
    inset -2px 0 4px rgba(0, 0, 0, 0.25),
    inset 4px 0 6px rgba(255, 255, 255, 0.08),
    var(--shadow-book);
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
  color: var(--paper);
}
.book::before {
  content: '';
  position: absolute;
  top: 16px; bottom: 16px;
  left: 4px;
  width: 1.5px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 1px;
}
.book::after {
  content: '';
  position: absolute;
  top: 16px; bottom: 16px;
  right: 4px;
  width: 1.5px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 1px;
}
.book:hover {
  transform: translateY(-12px);
  box-shadow:
    inset -2px 0 4px rgba(0, 0, 0, 0.25),
    inset 4px 0 6px rgba(255, 255, 255, 0.08),
    4px 6px 14px rgba(0, 0, 0, 0.22),
    12px 0 32px rgba(0, 0, 0, 0.22);
}
.book:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}
.book__title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 12px 0;
  max-height: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.book__author {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-top: auto;
  padding-bottom: 12px;
}
.book__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}
.book__badge--ready { background: var(--success); }
.book__badge--draft { background: var(--gold); }
.book__badge--problem { background: var(--marca); }

.book--new {
  background: transparent;
  border: 2px dashed var(--ink-faint);
  color: var(--ink-soft);
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.book--new::before, .book--new::after { display: none; }
.book--new:hover {
  border-color: var(--bind);
  color: var(--bind);
  transform: translateY(-6px);
  background: var(--bind-soft);
  box-shadow: none;
}
.book--new .book__plus {
  font-size: 2.5rem;
  font-weight: 200;
  line-height: 1;
}
.book--new .book__label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 12px;
}

/* Empty state na estante */
.shelf-empty {
  background: var(--paper-warm);
  border-radius: var(--radius-lg);
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  border: 1px dashed var(--rule);
}
.shelf-empty .h2 { margin-bottom: var(--sp-3); }
.shelf-empty .lead { margin: 0 auto var(--sp-5); }

/* ---------- Wizard / Steps ---------- */
.wizard {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--sp-7);
  margin-top: var(--sp-4);
}
.wizard__steps {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-5));
  align-self: start;
  height: max-content;
}
.wizard__steps-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 1px solid var(--rule);
}
.wizard__step {
  position: relative;
  padding: 10px 16px;
  font-size: var(--fs-sm);
  color: var(--ink-faint);
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.wizard__step::before {
  content: '';
  position: absolute;
  left: -1px; top: 50%;
  width: 3px; height: 60%;
  transform: translateY(-50%);
  background: transparent;
  border-radius: 0 2px 2px 0;
  transition: background var(--t-fast) var(--ease);
}
.wizard__step:hover { color: var(--ink-soft); background: var(--paper-warm); }
.wizard__step.is-active { color: var(--ink); font-weight: 500; }
.wizard__step.is-active::before { background: var(--bind); }
.wizard__step.is-done { color: var(--ink-soft); }
.wizard__step .step-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--rule-soft);
  color: var(--ink-soft);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wizard__step.is-active .step-num { background: var(--bind); color: var(--paper); }
.wizard__step.is-done .step-num {
  background: var(--success);
  color: var(--paper);
}
.wizard__step.is-done .step-num::after { content: '✓'; }
.wizard__step.is-done .step-num-text { display: none; }
.wizard__step:not(.is-done) .step-num::after { content: none; }
.wizard__step:not(.is-done) .step-num-text { display: block; }

.wizard__body {
  min-width: 0;
}
.wizard__panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 4vw, 2.5rem);
}
.wizard__head {
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--rule);
}
.wizard__head .eyebrow { margin-bottom: var(--sp-2); display: block; }
.wizard__head .lead { margin-top: var(--sp-3); }

.wizard__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--sp-7);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--rule);
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.wizard__nav .left { display: flex; gap: var(--sp-3); }
.wizard__nav .right { display: flex; gap: var(--sp-3); }

/* ---------- Tipos de livro / cards de seleção ---------- */
.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin: var(--sp-5) 0;
}
.option-card {
  position: relative;
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  text-align: left;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: 100%;
  font-family: inherit;
  color: inherit;
}
.option-card:hover {
  border-color: var(--bind);
  background: var(--paper-soft);
  transform: translateY(-1px);
}
.option-card.is-selected {
  border-color: var(--bind);
  background: var(--bind-soft);
  box-shadow: 0 0 0 1px var(--bind) inset;
}
.option-card.is-selected::after {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bind) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FCFAF7' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 60% no-repeat;
}
.option-card__icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--bind);
}
.option-card__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-lg);
  line-height: 1.2;
  font-variation-settings: 'opsz' 36;
}
.option-card__desc {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ---------- Análise KDP ---------- */
.analysis {
  display: grid;
  gap: var(--sp-5);
}
.analysis__summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-4);
}
.stat {
  background: var(--paper-warm);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  border: 1px solid var(--rule);
}
.stat__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.stat__value {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 400;
  line-height: 1;
  margin-top: 6px;
  font-variation-settings: 'opsz' 72;
}
.stat__unit { font-size: 0.7em; color: var(--ink-soft); }

.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.check {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  border-left: 3px solid var(--ink-faint);
}
.check--ok {
  border-left-color: var(--success);
  background: var(--success-soft);
}
.check--warn {
  border-left-color: var(--gold);
  background: var(--gold-soft);
}
.check--error {
  border-left-color: var(--marca);
  background: var(--marca-soft);
}
.check__icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  display: grid; place-items: center;
  color: var(--ink-faint);
  margin-top: 2px;
}
.check--ok .check__icon { color: var(--success); }
.check--warn .check__icon { color: var(--gold); filter: brightness(0.85); }
.check--error .check__icon { color: var(--marca); }
.check__body { flex: 1; min-width: 0; }
.check__title { font-weight: 500; font-size: var(--fs-sm); }
.check__msg { color: var(--ink-soft); font-size: var(--fs-sm); margin-top: 2px; }
.check__fix {
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  font-family: var(--font-mono);
}

/* ---------- Preview de páginas ---------- */
.preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--sp-5);
  margin-top: var(--sp-5);
}
@media (max-width: 980px) {
  .preview { grid-template-columns: 1fr; }
}
.preview__viewer {
  background: var(--paper-warm);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  min-height: 600px;
}
.preview__page {
  background: var(--surface);
  width: 100%;
  max-width: 480px;
  aspect-ratio: var(--page-ratio, 0.7);
  position: relative;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08), 0 12px 32px rgba(0,0,0,0.1);
  overflow: hidden;
  border-radius: 2px;
}
.preview__page-content {
  position: absolute;
  inset: 0;
  padding: var(--page-margin, 9%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink);
  overflow: hidden;
}
.preview__page-bleed-mark {
  position: absolute;
  inset: 3%;
  border: 1px dashed rgba(184, 65, 14, 0.3);
  pointer-events: none;
}
.preview__page-safe-mark {
  position: absolute;
  inset: 8%;
  border: 1px dotted rgba(45, 95, 78, 0.25);
  pointer-events: none;
}
.preview__nav {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-top: var(--sp-3);
}
.preview__counter {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  min-width: 80px;
  text-align: center;
}
.preview__sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* Mini estante de páginas */
.page-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: var(--sp-2) 0;
  scrollbar-width: thin;
}
.page-strip__thumb {
  flex: 0 0 auto;
  width: 56px;
  aspect-ratio: var(--page-ratio, 0.7);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
  font-size: 9px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  display: grid;
  place-items: center;
  padding: 0;
  transition: all var(--t-fast) var(--ease);
}
.page-strip__thumb:hover { border-color: var(--ink-soft); }
.page-strip__thumb.is-active {
  border-color: var(--bind);
  box-shadow: 0 0 0 1px var(--bind);
  color: var(--bind);
}

/* ---------- Cover preview ---------- */
.cover-preview {
  background: linear-gradient(180deg, #d6cdb8, #b8af9a);
  border-radius: var(--radius);
  padding: var(--sp-6);
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1200px;
  min-height: 380px;
}
.cover-3d {
  display: flex;
  transform: rotateY(-22deg) rotateX(2deg);
  transform-style: preserve-3d;
  filter: drop-shadow(0 25px 40px rgba(0,0,0,0.25));
}
.cover-3d__back {
  width: var(--cover-w, 160px);
  height: var(--cover-h, 230px);
  background: var(--cover-back, #1F4438);
  background-size: cover;
  background-position: center;
}
.cover-3d__spine {
  width: var(--spine-w, 20px);
  height: var(--cover-h, 230px);
  background: var(--spine-color, #2D5F4E);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--paper);
  position: relative;
}
.cover-3d__spine span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-display);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  max-height: 90%;
  text-overflow: ellipsis;
}
.cover-3d__front {
  width: var(--cover-w, 160px);
  height: var(--cover-h, 230px);
  background: var(--cover-front, #2D5F4E);
  background-size: cover;
  background-position: center;
  box-shadow: inset 6px 0 12px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  color: var(--paper);
}
.cover-3d__front .cover-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.cover-3d__front .cover-author {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.cover-flat {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  margin: var(--sp-4) auto;
  box-shadow: var(--shadow);
  position: relative;
  max-width: 100%;
}
.cover-flat .panel {
  position: relative;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
}
.cover-flat .panel--back { background: var(--cover-back, var(--rule)); }
.cover-flat .panel--spine {
  background: var(--spine-color, var(--bind));
  color: var(--paper);
}
.cover-flat .panel--front { background: var(--cover-front, var(--rule)); }
.cover-flat__ruler {
  position: absolute;
  top: -22px;
  left: 0;
  right: 0;
  display: flex;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-soft);
}

/* ---------- Upload de imagens ---------- */
.dropzone {
  border: 2px dashed var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  background: var(--paper-soft);
  transition: all var(--t-fast) var(--ease);
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-dragging {
  border-color: var(--bind);
  background: var(--bind-soft);
}
.dropzone__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--sp-3);
  color: var(--bind);
}
.dropzone__title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 500;
  margin-bottom: var(--sp-2);
}
.dropzone__hint { font-size: var(--fs-sm); color: var(--ink-soft); }

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}
.image-tile {
  position: relative;
  aspect-ratio: 1;
  background: var(--paper-warm);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--rule);
}
.image-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-tile__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.7));
  padding: var(--sp-2);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: var(--paper);
  font-size: var(--fs-xs);
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
}
.image-tile:hover .image-tile__overlay { opacity: 1; }
.image-tile__badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  background: rgba(0,0,0,0.7);
  color: var(--paper);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.image-tile__badge--warn { background: var(--gold); color: var(--ink); }
.image-tile__badge--error { background: var(--marca); }
.image-tile__remove {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: var(--paper);
  border: none;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
}
.image-tile:hover .image-tile__remove { opacity: 1; }

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed;
  bottom: var(--sp-5);
  right: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  z-index: 100;
  max-width: 360px;
}
.toast {
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: var(--fs-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  animation: toast-in 240ms var(--ease-out);
  border-left: 3px solid var(--gold);
}
.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--marca); }
.toast--info { border-left-color: var(--bind); }
.toast__close {
  background: transparent;
  border: none;
  color: var(--paper);
  opacity: 0.6;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
}
@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal__card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modal-in 240ms var(--ease-out);
}
@keyframes modal-in {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--rule);
}
.modal__title {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  margin: 0;
}
.modal__body {
  padding: var(--sp-5);
  overflow-y: auto;
  flex: 1;
}
.modal__foot {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  background: var(--paper-soft);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- Helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.row { display: flex; gap: var(--sp-3); align-items: center; }
.row--wrap { flex-wrap: wrap; }
.row--end { justify-content: flex-end; }
.row--between { justify-content: space-between; }
.spacer { flex: 1; }
.center { text-align: center; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--paper-warm);
  color: var(--ink-soft);
  border: 1px solid var(--rule);
}
.pill--accent { background: var(--bind-soft); color: var(--bind); border-color: rgba(45, 95, 78, 0.2); }
.pill--gold { background: var(--gold-soft); color: #8a6d2e; border-color: rgba(201, 169, 97, 0.3); }
.pill--success { background: var(--success-soft); color: var(--success); }
.pill--danger { background: var(--marca-soft); color: var(--marca); }

.divider {
  height: 1px;
  background: var(--rule);
  margin: var(--sp-5) 0;
  border: none;
}
.divider--ornate {
  text-align: center;
  position: relative;
  margin: var(--sp-6) 0;
}
.divider--ornate::before,
.divider--ornate::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: var(--rule);
}
.divider--ornate::before { left: 5%; }
.divider--ornate::after { right: 5%; }
.divider--ornate span {
  display: inline-block;
  padding: 0 var(--sp-3);
  background: var(--paper);
  color: var(--gold);
  font-family: var(--font-display);
  font-style: italic;
}

/* ---------- Loading ---------- */
.loading-screen {
  min-height: 50vh;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-style: italic;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--rule);
  border-top-color: var(--bind);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Mobile ---------- */
@media (max-width: 920px) {
  .wizard {
    grid-template-columns: 1fr;
    gap: var(--sp-4);
  }
  .wizard__steps {
    position: static;
    overflow-x: auto;
  }
  .wizard__steps-list {
    flex-direction: row;
    border-left: none;
    border-bottom: 1px solid var(--rule);
    padding-bottom: var(--sp-2);
  }
  .wizard__step {
    flex-shrink: 0;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
  }
  .wizard__step::before {
    left: 50%;
    bottom: -2px;
    top: auto;
    width: 24px;
    height: 3px;
    transform: translateX(-50%);
    border-radius: 2px 2px 0 0;
  }
}

@media (max-width: 720px) {
  .app-nav { display: none; }
  #menuToggle { display: grid; }
  .app-nav.is-open {
    display: flex;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--paper);
    flex-direction: column;
    padding: var(--sp-4);
    border-bottom: 1px solid var(--rule);
    gap: var(--sp-3);
  }
  .brand__sub { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .preview { grid-template-columns: 1fr; }
  .shelf__books { gap: 4px; }
  .book { width: 52px; height: 240px; }
}

/* ---------- Acessibilidade ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Print */
@media print {
  .app-header, .app-footer, .wizard__steps, .wizard__nav { display: none; }
  body { background: white; }
}

/* ============================================================
   v1.1 — Novos componentes
   ============================================================ */

/* ---------- Banner de alerta no topo de uma página ---------- */
.alert-banner {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-lg);
  margin-bottom: var(--sp-5);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.alert-banner__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
}
.alert-banner__body { flex: 1; min-width: 0; }
.alert-banner__title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: var(--fs-base);
}
.alert-banner__msg { color: var(--ink-soft); }
.alert-banner__actions {
  margin-top: var(--sp-3);
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.alert-banner--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
.alert-banner--error .alert-banner__title { color: #991b1b; }
.alert-banner--warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}
.alert-banner--warn .alert-banner__title { color: #92400e; }
.alert-banner--info {
  background: var(--bind-soft);
  border: 1px solid rgba(45, 95, 78, 0.2);
}
.alert-banner--info .alert-banner__title { color: var(--bind); }
.alert-banner--success {
  background: var(--success-soft);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ---------- Badge grande de DPI nas imagens (melhor visibilidade) ---------- */
.image-tile__badge {
  /* Override do tamanho original pra ficar bem maior */
  font-size: 11px !important;
  padding: 4px 8px !important;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.image-tile__badge--error {
  background: #dc2626 !important;
  color: white !important;
  animation: pulse-warn 2.5s ease-in-out infinite;
}
.image-tile__badge--warn {
  background: #f59e0b !important;
  color: white !important;
}
.image-tile.has-error {
  outline: 3px solid #dc2626;
  outline-offset: -3px;
}
.image-tile.has-warn {
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
}

@keyframes pulse-warn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ---------- Pré-flight panel (o que você vai precisar) ---------- */
.preflight {
  background: linear-gradient(135deg, var(--bind-soft) 0%, var(--gold-soft) 100%);
  border: 1px solid rgba(45, 95, 78, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-top: var(--sp-5);
}
.preflight__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.preflight__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.preflight__item {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-2) 0;
  border-bottom: 1px dashed rgba(45, 95, 78, 0.15);
  font-size: var(--fs-sm);
}
.preflight__item:last-child { border-bottom: none; }
.preflight__icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}
.preflight__label {
  font-weight: 500;
  color: var(--ink);
}
.preflight__detail {
  color: var(--ink-soft);
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* ---------- Fix card (na análise) ---------- */
.check__actions {
  margin-top: var(--sp-2);
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.check__action-btn {
  font-size: var(--fs-xs);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--t-fast) var(--ease);
}
.check__action-btn:hover {
  background: var(--bind);
  color: var(--paper);
  border-color: var(--bind);
}

/* ---------- Modal de instruções ---------- */
.howto {
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.howto h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  margin: var(--sp-4) 0 var(--sp-2);
}
.howto h4:first-child { margin-top: 0; }
.howto ol, .howto ul {
  margin: var(--sp-2) 0;
  padding-left: 1.4em;
}
.howto li { margin-bottom: 6px; }
.howto code,
.howto .code {
  background: var(--paper-warm);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}
.howto .external-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bind);
  color: var(--paper);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  text-decoration: none;
  margin: var(--sp-2) 0;
}
.howto .external-link:hover {
  background: var(--bind-dark, #1e4337);
  text-decoration: none;
}

/* ---------- Backup section ---------- */
.backup-bar {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4);
  background: var(--paper-warm);
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  margin-bottom: var(--sp-5);
}
.backup-bar__icon { font-size: 1.1rem; }
.backup-bar__text { flex: 1; min-width: 200px; }
.backup-bar__actions { display: flex; gap: 6px; }

/* ---------- Spinner ---------- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--rule);
  border-top-color: var(--bind);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Capa preview na lista de imagens (cover preview) ---------- */
.image-tile--cover {
  aspect-ratio: 2/3;
}
.image-tile--cover img { object-fit: contain; background: var(--paper-warm); }
