/* =========================================================
   ESTÚDIO DE COLORIR — Identidade visual de ateliê de arte
   ========================================================= */

:root {
  /* Paleta */
  --paper:        #FBF8F3;
  --paper-warm:   #F2EBDC;
  --ink:          #1A1A1A;
  --ink-soft:     #4A4A4A;
  --ink-faint:    #8B8B8B;

  /* Acentos */
  --marca:        #B8410E;   /* terracota (vermelho marcador) */
  --marca-dark:   #8B2F08;
  --marca-soft:   #FDF1E8;
  --gold:         #C9A961;
  --gold-soft:    #F9F3E1;
  --bind:         #2D5F4E;   /* verde botânico (folha) */
  --bind-soft:    #E8F0EC;
  --sky:          #6B8FA8;
  --sky-soft:     #E6EDF2;

  /* Status */
  --success:      #10b981;
  --success-soft: #D4F3E5;
  --warn:         #F59E0B;
  --warn-soft:    #FEF3D7;
  --error:        #DC2626;
  --error-soft:   #FEE9E9;

  /* Linhas */
  --rule:         #E8E0D0;
  --rule-strong:  #C9BFA8;

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

  --fs-xs:   0.75rem;
  --fs-sm:   0.875rem;
  --fs-base: 1rem;
  --fs-lg:   1.125rem;
  --fs-xl:   1.375rem;
  --fs-2xl:  1.75rem;
  --fs-3xl:  2.5rem;

  /* Espaçamento */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow:    0 2px 8px rgba(26,26,26,0.08);
  --shadow-lg: 0 8px 30px rgba(26,26,26,0.12);

  /* Motion */
  --t-fast: 150ms;
  --t-med:  250ms;
  --t-slow: 400ms;
  --ease:   cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ Reset ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--marca); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--marca-dark); }

/* ============ Layout principal ============ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  background: rgba(251, 248, 243, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand__mark { flex-shrink: 0; }
.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand__name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.brand__sub {
  font-size: 0.7rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  margin-top: 2px;
}

.app-nav {
  display: flex;
  gap: var(--sp-2);
}
.app-nav__link {
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  font-weight: 500;
  transition: all var(--t-fast) var(--ease);
}
.app-nav__link:hover {
  background: var(--paper-warm);
  color: var(--ink);
}
.app-nav__link.is-active {
  background: var(--marca-soft);
  color: var(--marca);
}

.app-nav__toggle {
  display: none;
  background: transparent;
  border: none;
  padding: 8px;
  flex-direction: column;
  gap: 4px;
}
.app-nav__toggle span {
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  transition: all var(--t-fast) var(--ease);
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-5);
}

.app-footer {
  padding: var(--sp-5);
  text-align: center;
  color: var(--ink-faint);
  font-size: var(--fs-xs);
  border-top: 1px solid var(--rule);
}
.font-mono { font-family: var(--font-mono); }

/* ============ Tipografia ============ */
.h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
.h2 {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  font-weight: 400;
  line-height: 1.2;
  margin: 0;
  color: var(--ink);
}
.h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.3;
  margin: 0;
  color: var(--ink);
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--marca);
  margin-bottom: var(--sp-2);
}

.lead {
  font-size: var(--fs-lg);
  color: var(--ink-soft);
  line-height: 1.5;
  margin: var(--sp-2) 0 0;
}

.page-header { margin-bottom: var(--sp-5); }

/* ============ Botões ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn--lg {
  padding: 14px 28px;
  font-size: var(--fs-base);
  border-radius: var(--radius-lg);
}
.btn--sm {
  padding: 6px 12px;
  font-size: var(--fs-xs);
}
.btn--block {
  display: flex;
  width: 100%;
}

.btn--primary {
  background: var(--marca);
  color: var(--paper);
}
.btn--primary:hover {
  background: var(--marca-dark);
  color: var(--paper);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

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

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

.btn--gold {
  background: var(--gold);
  color: var(--ink);
}
.btn--gold:hover {
  background: #B89952;
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn--danger {
  background: transparent;
  color: var(--error);
  border-color: rgba(220, 38, 38, 0.3);
}
.btn--danger:hover {
  background: var(--error);
  color: var(--paper);
}

/* ============ Inputs ============ */
.label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}

.input, .select, .textarea {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--paper);
  transition: all var(--t-fast) var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--marca);
  box-shadow: 0 0 0 3px rgba(184, 65, 14, 0.1);
}

.textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.55;
}

input[type="color"] {
  width: 50px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--paper);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--marca);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--marca);
  cursor: pointer;
}

/* ============ Cards ============ */
.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.card--soft { background: var(--paper-warm); border-color: var(--rule); }
.card--accent { background: var(--marca-soft); border-color: rgba(184, 65, 14, 0.2); }
.card--gold { background: var(--gold-soft); border-color: rgba(201, 169, 97, 0.3); }
.card--success { background: var(--success-soft); border-color: rgba(16, 185, 129, 0.2); }
.card--alert { background: var(--error-soft); border-color: rgba(220, 38, 38, 0.2); }

/* ============ Pills ============ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 500;
  background: var(--paper-warm);
  color: var(--ink-soft);
  border: 1px solid var(--rule);
}
.pill--accent { background: var(--marca-soft); color: var(--marca); border-color: rgba(184, 65, 14, 0.2); }
.pill--gold { background: var(--gold-soft); color: #8a7430; border-color: rgba(201, 169, 97, 0.3); }
.pill--bind { background: var(--bind-soft); color: var(--bind); border-color: rgba(45, 95, 78, 0.2); }
.pill--ready { background: var(--success-soft); color: var(--success); border-color: rgba(16, 185, 129, 0.2); }

/* ============ Stats ============ */
.stat {
  padding: var(--sp-4);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  min-width: 130px;
}
.stat__label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.stat__value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1;
  color: var(--ink);
}

/* ============ Helpers de layout ============ */
.row {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
}
.row--wrap { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--center { justify-content: center; }
.row--end { justify-content: flex-end; }

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-3);
}

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

/* ============ Dashboard — Estante de livros (mas estilo "ateliê de obras") ============ */
.atelier {
  position: relative;
  margin-top: var(--sp-6);
  padding: var(--sp-6) 0;
}

.atelier__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-4);
}

.book-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--t-med) var(--ease);
  text-decoration: none;
  color: inherit;
  aspect-ratio: 3/4;
}
.book-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  color: inherit;
  border-color: var(--marca);
}

.book-card__cover {
  flex: 1;
  position: relative;
  background: linear-gradient(135deg, var(--book-color, var(--marca)) 0%, color-mix(in srgb, var(--book-color, var(--marca)) 70%, black) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.book-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-card__placeholder {
  font-family: var(--font-display);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.92);
  font-size: 1rem;
  text-align: center;
  padding: var(--sp-4);
  line-height: 1.3;
}

.book-card__info {
  padding: var(--sp-3);
  background: var(--paper);
}
.book-card__title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.book-card__meta {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.book-card__badge {
  position: absolute;
  top: var(--sp-2);
  right: var(--sp-2);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  z-index: 1;
}
.book-card__badge--ready { background: var(--success); border-color: var(--success); color: white; }
.book-card__badge--draft { background: var(--gold); border-color: var(--gold); color: white; }

.book-card--new {
  border: 2px dashed var(--rule-strong);
  background: transparent;
  align-items: center;
  justify-content: center;
}
.book-card--new:hover {
  border-color: var(--marca);
  background: var(--marca-soft);
  color: var(--marca);
}
.book-card--new__plus {
  font-size: 3rem;
  color: var(--ink-faint);
  margin-bottom: var(--sp-2);
  line-height: 1;
}
.book-card--new:hover .book-card--new__plus { color: var(--marca); }
.book-card--new__label {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--ink-soft);
}
.book-card--new:hover .book-card--new__label { color: var(--marca); }

.atelier-empty {
  text-align: center;
  padding: var(--sp-7) var(--sp-4);
  max-width: 460px;
  margin: 0 auto;
}

/* ============ Wizard ============ */
.wizard-header { margin-bottom: var(--sp-5); }

.wizard {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--sp-6);
  align-items: flex-start;
}

.wizard__steps {
  position: sticky;
  top: 80px;
  background: var(--paper-warm);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  border: 1px solid var(--rule);
}
.wizard__steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wizard__step {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  text-decoration: none;
  transition: all var(--t-fast) var(--ease);
}
.wizard__step:hover {
  background: var(--paper);
  color: var(--ink);
}
.wizard__step.is-active {
  background: var(--marca);
  color: var(--paper);
}
.wizard__step.is-active .step-num {
  background: var(--paper);
  color: var(--marca);
}
.wizard__step.is-done .step-num {
  background: var(--success);
  color: var(--paper);
  border-color: var(--success);
}
.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
}
.wizard__step.is-done .step-num-text::after { content: '✓'; }
.wizard__step.is-done .step-num-text > * { display: none; }

.wizard__body {
  min-width: 0;
}

.wizard__panel {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
}
.wizard__head { margin-bottom: var(--sp-5); }

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

/* ============ Option grid ============ */
.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-3);
}
.option-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: var(--sp-4);
  background: var(--paper);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: all var(--t-fast) var(--ease);
  font-family: inherit;
  width: 100%;
}
.option-card:hover {
  border-color: var(--marca);
  background: var(--marca-soft);
  transform: translateY(-1px);
}
.option-card.is-selected {
  border-color: var(--marca);
  background: var(--marca-soft);
  box-shadow: 0 0 0 3px rgba(184, 65, 14, 0.1);
}
.option-card.is-selected::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 10px;
  color: var(--marca);
  font-weight: 700;
}
.option-card__icon { font-size: 1.6rem; margin-bottom: 4px; }
.option-card__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
}
.option-card__desc {
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  line-height: 1.4;
}

/* ============ Galeria de páginas geradas ============ */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

.page-tile {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 8.5/11;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.page-tile:hover {
  border-color: var(--marca);
  box-shadow: var(--shadow);
  transform: scale(1.02);
}
.page-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: white;
}
.page-tile__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--paper-warm);
  color: var(--ink-faint);
  font-size: var(--fs-sm);
  gap: 10px;
}
.page-tile__number {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(26, 26, 26, 0.85);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.page-tile__status {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(26, 26, 26, 0.85);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 3px 7px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.page-tile__status--generating {
  background: var(--marca);
}
.page-tile__status--ok {
  background: rgba(16, 185, 129, 0.9);
}
.page-tile__status--error {
  background: rgba(220, 38, 38, 0.9);
}

.page-tile__actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
}
.page-tile:hover .page-tile__actions {
  opacity: 1;
}
.page-tile__action {
  background: rgba(26, 26, 26, 0.85);
  color: var(--paper);
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all var(--t-fast) var(--ease);
}
.page-tile__action:hover {
  background: var(--marca);
  transform: scale(1.1);
}

/* ============ Progress bar geração ============ */
.progress {
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
}
.progress__bar {
  height: 8px;
  background: var(--rule);
  border-radius: 999px;
  overflow: hidden;
  margin: var(--sp-3) 0;
}
.progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--marca) 0%, var(--gold) 100%);
  border-radius: 999px;
  transition: width var(--t-med) var(--ease);
}
.progress__info {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
}
.progress__info strong { color: var(--ink); }

/* ============ Dropzone ============ */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-7) var(--sp-4);
  background: var(--paper-warm);
  border: 2px dashed var(--rule-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.dropzone:hover, .dropzone.is-dragging {
  background: var(--marca-soft);
  border-color: var(--marca);
}
.dropzone__icon { font-size: 2.5rem; margin-bottom: var(--sp-2); }
.dropzone__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: var(--sp-1);
  color: var(--ink);
}
.dropzone__hint {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
}

/* ============ Toast ============ */
.toast-stack {
  position: fixed;
  top: 80px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-lg);
  animation: toast-in 280ms var(--ease);
  max-width: 340px;
}
.toast--success { background: var(--success); }
.toast--warn { background: var(--gold); color: var(--ink); }
.toast--error { background: var(--error); }

@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============ Modal ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: var(--sp-4);
  animation: fade-in 200ms ease;
}
.modal {
  background: var(--paper);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in 260ms var(--ease);
}
.modal__header {
  padding: var(--sp-5);
  border-bottom: 1px solid var(--rule);
}
.modal__title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  margin: 0;
}
.modal__body { padding: var(--sp-5); }
.modal__footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  background: var(--paper-warm);
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { transform: translateY(-12px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

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

/* ============ Banners de alerta ============ */
.alert-banner {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-4);
  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.4rem;
  flex-shrink: 0;
  line-height: 1;
}
.alert-banner__body { flex: 1; }
.alert-banner__title {
  font-weight: 600;
  margin-bottom: 4px;
}
.alert-banner__msg { color: var(--ink-soft); }
.alert-banner--info {
  background: var(--sky-soft);
  border: 1px solid rgba(107, 143, 168, 0.2);
}
.alert-banner--warn {
  background: var(--warn-soft);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #92400e;
}
.alert-banner--success {
  background: var(--success-soft);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.alert-banner--error {
  background: var(--error-soft);
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: #991b1b;
}

/* ============ Imagem preview no modal ============ */
.image-preview-modal {
  background: white;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  max-height: 70vh;
  width: 100%;
  object-fit: contain;
}

/* ============ Responsivo ============ */
@media (max-width: 820px) {
  .wizard {
    grid-template-columns: 1fr;
  }
  .wizard__steps {
    position: relative;
    top: 0;
    padding: var(--sp-2);
  }
  .wizard__steps-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .wizard__step {
    flex-shrink: 0;
    padding: 6px 10px;
  }
  .wizard__step span:last-child { display: none; }
  .wizard__step.is-active span:last-child { display: inline; }
  .app-main { padding: var(--sp-4) var(--sp-3); }
  .wizard__panel { padding: var(--sp-4); }
}

@media (max-width: 600px) {
  .app-nav { display: none; }
  .app-nav.is-open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    flex-direction: column;
    padding: var(--sp-3);
    border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow);
  }
  .app-nav__toggle { display: flex; }
  .brand__sub { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .atelier__grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
  .gallery { grid-template-columns: repeat(2, 1fr); }
}

/* ============ Reference slots (upload de imagens guia) ============ */
.ref-slot {
  position: relative;
  aspect-ratio: 4/5;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--t-fast) var(--ease);
}
.ref-slot--filled {
  border: 2px solid var(--marca);
  background: var(--paper);
}
.ref-slot--filled img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ref-slot--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--rule-strong);
  background: var(--paper-warm);
  cursor: pointer;
  text-align: center;
  padding: var(--sp-3);
}
.ref-slot--empty:hover {
  border-color: var(--marca);
  background: var(--marca-soft);
  color: var(--marca);
}
.ref-slot__icon {
  font-size: 2.5rem;
  color: var(--ink-faint);
  line-height: 1;
}
.ref-slot--empty:hover .ref-slot__icon {
  color: var(--marca);
}
.ref-slot__hint {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  margin-top: var(--sp-2);
}
.ref-slot__label {
  position: absolute;
  bottom: 6px;
  left: 6px;
  padding: 3px 10px;
  background: rgba(26, 26, 26, 0.8);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  border-radius: 4px;
}
.ref-slot--empty .ref-slot__label {
  position: static;
  background: transparent;
  color: var(--ink-faint);
  margin-top: var(--sp-3);
}
.ref-slot__remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.9);
  color: white;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast) var(--ease);
}
.ref-slot__remove:hover {
  background: var(--error);
  transform: scale(1.1);
}

.page-tile--master {
  position: relative;
}
.page-tile--master .page-tile__number {
  background: var(--marca);
  font-weight: 700;
}

@media (max-width: 600px) {
  .ref-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: var(--sp-2) !important;
  }
  .ref-slot__icon { font-size: 1.5rem; }
  .ref-slot__hint { font-size: 0.7rem; }
}

/* 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(--marca);
  outline-offset: 2px;
}

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