/* ───────────────────────────────────────────────
   SELF-HOSTED INTER — same-origin so html-to-image can embed via fetch('self')
   ─────────────────────────────────────────────── */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('./fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('./fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('./fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('./fonts/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 800; font-display: swap; src: url('./fonts/inter-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 900; font-display: swap; src: url('./fonts/inter-latin-900-normal.woff2') format('woff2'); }

/* ───────────────────────────────────────────────
   APP SHELL
   ─────────────────────────────────────────────── */
:root {
  --bege: #F3EFE7;
  --creme: #EFE4D4;
  --branco-quente: #FBF8F2;
  --marrom-suave: #7A6249;
  --marrom-escuro: #2E2A24;
  --verde: #4F7B52;
  --verde-suave: #C5DFC0;
  --verde-claro: #EDF4EA;
  --cinza-quente: #6B6257;
  --cinza-claro: #DED2C0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bege); color: var(--marrom-escuro); font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif; -webkit-font-smoothing: antialiased; }

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* HEADER ─────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(243, 239, 231, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(122, 98, 73, 0.12);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-header .brand .logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--verde);
  display: grid; place-items: center;
  color: #fff; font-weight: 900; font-size: 16px;
  letter-spacing: -0.04em;
}
.app-header .brand h1 {
  font-size: 17px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1;
}
.app-header .brand h1 small {
  display: block; font-size: 12px; font-weight: 500; color: var(--cinza-quente); letter-spacing: 0;
}
.app-header .brand h1 .app-version {
  display: block; font-size: 10px; font-weight: 400; font-family: monospace;
  color: var(--cinza-quente); opacity: 0.55; letter-spacing: 0.04em; margin-top: 1px;
}
.header-actions {
  display: flex; align-items: center; gap: 10px;
}

/* BUTTONS ────────────────────────────────────── */
.btn {
  font-family: inherit;
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.06s ease, background 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--marrom-escuro); color: #fff;
  box-shadow: 0 6px 16px rgba(46, 42, 36, 0.18);
}
.btn-primary:hover { background: #3a342c; }
.btn-primary:disabled { background: #b6ad9f; box-shadow: none; cursor: not-allowed; color: #f3efe7; }
.btn-secondary {
  background: #fff; color: var(--marrom-escuro);
  border: 1px solid rgba(122, 98, 73, 0.15);
}
.btn-secondary:hover { background: #faf6ed; }
.btn-ghost {
  background: transparent; color: var(--marrom-suave); padding: 8px 10px;
}
.btn-ghost:hover { background: rgba(122, 98, 73, 0.08); }
.btn-accent {
  background: var(--verde); color: #fff;
  box-shadow: 0 8px 20px rgba(79, 123, 82, 0.28);
}
.btn-accent:hover { background: #43694a; }
.btn-accent:disabled { background: #b6c8b6; box-shadow: none; cursor: not-allowed; }

/* HERO / DROP ZONE ───────────────────────────── */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 28px 40px;
  width: 100%;
}
.hero h2 {
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin-bottom: 14px;
  max-width: 700px;
  text-wrap: balance;
}
.hero p {
  font-size: 16px;
  color: var(--cinza-quente);
  max-width: 620px;
  line-height: 1.45;
}

.dropzone {
  margin-top: 32px;
  border: 2px dashed rgba(122, 98, 73, 0.32);
  border-radius: 20px;
  background: rgba(255,255,255,0.55);
  padding: 44px 28px;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
.dropzone.dragover {
  border-color: var(--verde);
  background: rgba(197, 223, 192, 0.35);
}
.dropzone .dz-icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--branco-quente);
  display: grid; place-items: center;
  border: 1px solid rgba(122, 98, 73, 0.12);
}
.dropzone h3 {
  font-size: 18px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.015em;
}
.dropzone p {
  font-size: 14px; color: var(--cinza-quente); margin-bottom: 16px;
}
.dropzone .dz-actions {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}

/* META / STATS BAR ───────────────────────────── */
.batch-meta {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 28px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.stats {
  display: flex; gap: 22px; flex-wrap: wrap;
}
.stat {
  display: flex; flex-direction: column;
}
.stat .label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--marrom-suave);
}
.stat .value {
  font-size: 22px; font-weight: 800; letter-spacing: -0.02em;
}
.batch-actions {
  display: flex; gap: 10px;
}

/* FILTER PILLS ───────────────────────────────── */
.filter-row {
  max-width: 1400px;
  margin: 0 auto;
  padding: 4px 28px 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.view-switch {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 28px 4px;
  display: flex;
  gap: 8px;
}
.library-layout {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 28px 60px;
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
}
.library-dropzone { margin-top: 0; margin-bottom: 14px; }
.library-filters { display: grid; grid-template-columns: 2fr 2fr .8fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.library-filters input, .library-filters select, .library-side input, .library-side textarea {
  border: 1px solid rgba(122,98,73,.22); border-radius: 10px; padding: 10px; font-family: inherit; background: #fff;
}
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.library-card { border: 1px solid rgba(122,98,73,.2); background: #fff; border-radius: 12px; padding: 8px; text-align: left; cursor: pointer; }
.library-card.active { border-color: var(--verde); box-shadow: inset 0 0 0 1px var(--verde); }
.library-card img { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; }
.library-meta { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; font-size: 12px; color: var(--cinza-quente);}
.media-badge { width: fit-content; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.media-badge-uploaded, .media-badge-analyzing { background: #fff3cd; color: #7a5d00; }
.media-badge-ready { background: #dff7e5; color: #1f6b3d; }
.media-badge-error { background: #fde7e0; color: #883315; }
.tag-list { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.tag-list span { font-size: 11px; background: var(--verde-claro); color: var(--verde); border-radius: 999px; padding: 2px 7px; }
.library-side { background: rgba(255,255,255,.7); border: 1px solid rgba(122,98,73,.15); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; height: fit-content; position: sticky; top: 90px; }
.library-side label { font-size: 12px; font-weight: 700; color: var(--marrom-suave); }
.meta-block { margin-top: 8px; font-size: 13px; color: var(--cinza-quente); display: flex; flex-direction: column; gap: 4px; }
.filter-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(122, 98, 73, 0.14);
  color: var(--marrom-suave);
  cursor: pointer;
  letter-spacing: -0.005em;
}
.filter-pill.active {
  background: var(--marrom-escuro);
  color: #fff;
  border-color: var(--marrom-escuro);
}
.filter-pill .count {
  margin-left: 6px;
  opacity: 0.7;
}

/* GRID ──────────────────────────────────────── */
.grid {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 28px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 22px;
}
.card {
  background: #fff;
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 8px 22px rgba(75, 55, 30, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  cursor: pointer;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(75, 55, 30, 0.14);
}
.card-thumb {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  overflow: auto;
  position: relative;
  background: var(--cinza-claro);
}
.card-thumb .scale-wrap {
  position: absolute;
  top: 0; left: 0;
  width: 1080px; height: 1920px;
  transform-origin: top left;
}
.card-foot {
  padding: 4px 6px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card-foot .row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card-foot .id {
  font-size: 11px; font-weight: 800; color: var(--marrom-suave); letter-spacing: 0.04em;
}
.card-foot .tpl {
  font-size: 10px; font-weight: 800; padding: 3px 7px; border-radius: 999px; background: var(--verde-claro); color: var(--verde); letter-spacing: 0.04em;
}
.card-foot .name {
  font-size: 13px; font-weight: 700; letter-spacing: -0.01em; color: var(--marrom-escuro);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* EMPTY STATE ───────────────────────────────── */
.empty {
  max-width: 720px;
  margin: 80px auto;
  text-align: center;
  padding: 0 28px;
}
.empty h3 { font-size: 22px; margin-bottom: 8px; letter-spacing: -0.02em; }
.empty p { color: var(--cinza-quente); font-size: 15px; line-height: 1.45; }

/* MODAL — Edit ──────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(46, 42, 36, 0.55);
  z-index: 200;
  display: grid; place-items: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--branco-quente);
  border-radius: 22px;
  width: min(1080px, 100%);
  height: min(900px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 34%);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
}
.modal-preview {
  background: #2e2a24;
  display: grid;
  place-items: center;
  padding: 16px;
  min-height: 0;
  overflow: hidden;
}

.modal-preview > div {
  max-width: 100%;
  max-height: 100%;
}
.modal-form {
  padding: 22px 22px 18px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.image-source-field {
  display: grid;
  gap: 8px;
}
.image-source-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.image-source-actions .btn {
  white-space: normal;
  text-align: center;
  line-height: 1.2;
  min-height: 44px;
}
.image-source-meta {
  display: grid;
  gap: 8px;
}
.btn-full {
  width: 100%;
  justify-content: center;
}
.modal-form .head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.modal-form .head h3 {
  font-size: 16px; font-weight: 800; letter-spacing: -0.01em;
}
.modal-form .field label {
  display: block;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--marrom-suave);
  margin-bottom: 6px;
}
.modal-form .field input,
.modal-form .field textarea,
.modal-form .field select {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  background: #fff;
  border: 1px solid rgba(122, 98, 73, 0.2);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--marrom-escuro);
  outline: none;
  transition: border-color 0.1s ease;
  resize: vertical;
}
.modal-form .field textarea { min-height: 64px; line-height: 1.35; }
.modal-form .field input:focus,
.modal-form .field textarea:focus,
.modal-form .field select:focus {
  border-color: var(--verde);
}
.modal-foot {
  display: flex; justify-content: space-between; gap: 10px; padding-top: 6px;
  border-top: 1px solid rgba(122, 98, 73, 0.12);
  margin-top: 6px;
  padding-top: 14px;
}

@media (max-width: 820px) {
  .modal {
    grid-template-columns: 1fr;
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }
  .modal-preview { min-height: 360px; }
  .image-source-actions { grid-template-columns: 1fr; }
}

/* ───────────────────────────────────────────────
   AD FRAME — 1080x1920 base
   ─────────────────────────────────────────────── */
.ad-frame {
  width: 1080px;
  height: 1920px;
  position: relative;
  overflow: hidden;
  background: var(--cinza-claro);
  color: var(--marrom-escuro);
  font-family: Inter, sans-serif;
}
.photo-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
}
.photo-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
}

/* ─── TEMPLATE 1 ──────────────────────────── */
.t1-core {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 1080px;
  padding: 90px 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
}
.t1-pill {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.95);
  color: var(--marrom-suave);
  border-radius: 999px;
  padding: 16px 28px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.005em;
  box-shadow: 0 12px 28px rgba(0,0,0,0.18);
  margin-bottom: 38px;
  max-width: 100%;
  overflow: hidden;
}
.t1-headline {
  font-size: 100px;
  font-weight: 900;
  line-height: 0.96;
  letter-spacing: -0.05em;
  text-shadow: 0 8px 28px rgba(0,0,0,0.28);
  margin-bottom: 28px;
  text-wrap: balance;
}
.t1-sub {
  font-size: 44px;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.015em;
  color: rgba(255,255,255,0.95);
  max-width: 92%;
  text-wrap: balance;
}
.t1-brand {
  position: absolute;
  bottom: 90px;
  left: 90px;
  right: 90px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.85);
}

/* ─── TEMPLATE 2 ──────────────────────────── */
.t2-split {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.t2-half {
  position: relative;
  height: 100%;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.t2-before {}
.t2-after {}
.t2-half-title {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-size: 32px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
  background: rgba(0,0,0,0.32);
  padding: 12px 22px;
  border-radius: 999px;
}
.t2-after .t2-half-title {
  background: var(--verde);
}
.t2-scribble-list, .t2-clean-list {
  position: absolute;
  left: 38px; right: 38px;
  top: 34%;
  display: grid;
  gap: 20px;
}
.t2-scribble-list div {
  color: #fff;
  background: rgba(255,255,255,0.16);
  text-decoration: line-through;
  transform: rotate(-1.5deg);
  border-radius: 16px;
  padding: 20px 22px;
  font-weight: 800;
  font-size: 34px;
  letter-spacing: -0.01em;
}
.t2-clean-list div {
  color: #3f623f;
  background: rgba(255,255,255,0.82);
  border-radius: 16px;
  padding: 20px 22px;
  font-weight: 800;
  font-size: 34px;
  letter-spacing: -0.01em;
}
.t2-core {
  position: absolute;
  left: 0;
  right: 0;
  top: 60%;
  transform: translateY(-50%);
  display: flex;
  justify-content: center;
  padding: 0 60px;
  z-index: 5;
}
.t2-copy {
  width: 100%;
  max-width: 920px;
  background: rgba(255,255,255,0.96);
  padding: 38px 38px;
  border-radius: 28px;
  box-shadow: 0 24px 50px rgba(0,0,0,0.16);
}
.t2-copy h2 {
  font-size: clamp(42px, 5.2vw, 56px);
  letter-spacing: -0.04em;
  line-height: 1.0;
  margin-bottom: 16px;
  text-wrap: balance;
}
.t2-copy p {
  font-size: 32px;
  line-height: 1.25;
  color: var(--cinza-quente);
  font-weight: 600;
}
.t2-tag {
  display: inline-block;
  margin-top: 18px;
  padding: 10px 28px;
  border-radius: 999px;
  background: var(--verde);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.005em;
  max-width: 100%;
  overflow: hidden;
}

/* ─── TEMPLATE 3 ──────────────────────────── */
.t3-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
}

.t3-core {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 1080px;
  padding: 60px 60px 50px;
  display: flex;
  flex-direction: column;
}
.t3-headline {
  font-size: 76px;
  font-weight: 900;
  line-height: 0.96;
  letter-spacing: -0.04em;
  color: var(--marrom-escuro);
  margin-bottom: 38px;
  text-wrap: balance;
}
.t3-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  flex: 1;
  min-height: 0;
  max-height: 660px;
  align-items: stretch;
}
.t3-checklist {
  background: #fff;
  border-radius: 26px;
  padding: 32px;
  box-shadow: 0 18px 36px rgba(90, 70, 40, 0.14);
  display: flex; flex-direction: column;
  align-self: start;
}
.t3-checklist h4 {
  font-size: 34px;
  margin-bottom: 20px;
  color: var(--marrom-suave);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.t3-checklist p {
  font-size: 28px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--marrom-escuro);
  margin-bottom: 12px;
}
.t3-sub-note {
  margin-top: auto;
  font-size: 24px !important;
  color: var(--cinza-quente) !important;
  font-weight: 500 !important;
  border-top: 1px dashed rgba(122,98,73,0.2);
  padding-top: 14px;
}
.t3-phone {
  background: #252525;
  border-radius: 40px;
  padding: 12px;
  box-shadow: 0 24px 50px rgba(0,0,0,0.22);
  transform: rotate(3deg);
  align-self: center;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 100%;
}
.t3-screen {
  width: 100%; height: 100%;
  border-radius: 26px;
  background: var(--branco-quente);
  padding: 20px 16px;
  overflow: hidden;
}
.t3-screen h3 {
  font-size: 32px;
  margin-bottom: 20px;
  color: var(--verde);
  font-weight: 800;
}
.t3-meal {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--verde-claro);
  margin-bottom: 10px;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 24px;
  font-weight: 800;
  color: #3f623f;
}
.t3-cta {
  position: relative;
  z-index: 1;
  margin-top: 32px;
  align-self: flex-start;
  display: inline-block;
  padding: 14px 32px;
  border-radius: 999px;
  background: var(--marrom-escuro);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.005em;
  max-width: 100%;
  overflow: hidden;
}

/* ─── TEMPLATE 4 ──────────────────────────── */
.t4-core {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 1080px;
  display: grid;
  place-items: center;
  padding: 60px;
}
.t4-quote {
  width: 100%;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(8px);
  border-radius: 36px;
  padding: 70px 56px;
  box-shadow: 0 24px 60px rgba(75, 55, 30, 0.18);
  text-align: center;
}
.t4-quote h2 {
  font-size: 92px;
  letter-spacing: -0.055em;
  line-height: 0.94;
  margin-bottom: 28px;
  color: var(--marrom-escuro);
  text-wrap: balance;
}
.t4-quote p {
  font-size: 40px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--cinza-quente);
  max-width: 740px;
  margin: 0 auto 28px;
  text-wrap: balance;
}
.t4-tag {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 999px;
  background: var(--verde);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.005em;
  max-width: 100%;
  overflow: hidden;
}

/* Spinner ──────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* OVERLAYS / EXTRAS ────────────────────────── */
.card-overlay {
  position: absolute; inset: 0;
  background: rgba(46,42,36,0.62);
  display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: -0.005em;
  border-radius: 12px;
  backdrop-filter: blur(2px);
}
.card-badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(46,42,36,0.85);
  color: #fff;
  font-size: 10px; font-weight: 800; letter-spacing: 0.05em;
  padding: 5px 9px;
  border-radius: 999px;
  display: inline-flex; align-items: center; gap: 4px;
}
.dot-warning {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #d97757; box-shadow: 0 0 0 2px rgba(243,239,231,0.92);
}
.btn-icon { position: relative; padding: 8px; }
.spinner-lg { width: 28px; height: 28px; border-width: 3px; }

/* Hero warning ─────────────────────────────── */
.hero-warning {
  margin-top: 22px;
  background: #fff7e6;
  border: 1px solid #f0d8a4;
  color: #6b4f1b;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
}
.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: #6b4f1b; text-decoration: underline; font-weight: 700;
  font-family: inherit; font-size: inherit;
}

/* Modal narrow (settings) ──────────────────── */
.modal-narrow {
  grid-template-columns: 1fr !important;
  max-width: 560px;
}
.field-help {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--cinza-quente);
  background: rgba(122, 98, 73, 0.06);
  border-radius: 10px;
  padding: 12px 14px;
}
.field-help code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  background: rgba(122, 98, 73, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}
.field-help a { color: var(--verde); font-weight: 700; }

.status-bar {
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
  line-height: 1.4;
}
.status-bar.success { background: var(--verde-claro); color: #3f623f; }
.status-bar.error { background: #fde7e0; color: #883315; }

/* Progress overlay ────────────────────────── */
.progress-card {
  background: var(--branco-quente);
  border-radius: 20px;
  padding: 28px 28px;
  width: min(440px, 92vw);
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
}
.progress-card h3 {
  font-size: 17px; letter-spacing: -0.015em; margin-bottom: 6px;
}
.progress-card p {
  font-size: 13px; color: var(--cinza-quente); margin-bottom: 16px;
  min-height: 1.2em;
}
.progress-track {
  width: 100%; height: 8px; background: rgba(122,98,73,0.14); border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--verde); transition: width 0.25s ease;
}
.progress-meta {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--marrom-suave);
}

/* Toast ─────────────────────────────────────── */
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: var(--marrom-escuro);
  color: #fff;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 20px 50px rgba(0,0,0,0.28);
  z-index: 1000;
  display: flex; gap: 10px; align-items: center;
  animation: slideIn 0.2s ease;
  max-width: 360px;
}
.toast.success { background: var(--verde); }
.toast.error { background: #b13a3a; }
@keyframes slideIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Export Log Panel ──────────────────────────── */
.export-log-wrap {
  position: fixed;
  bottom: 72px;
  right: 22px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.export-log-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #2a2a2a;
  color: #bbb;
  border: none;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  transition: background 0.15s;
}
.export-log-btn:hover { background: #3a3a3a; }
.export-log-btn.has-error { background: #4a1a1a; color: #f88; }
.export-log-btn.has-warn  { background: #3a2e00; color: #f0c040; }
.log-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%;
  font-size: 10px; font-weight: 900;
}
.log-badge.error { background: #e44; color: #fff; }
.log-badge.warn  { background: #f90; color: #000; }
.export-log-panel {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  width: 540px;
  max-height: 380px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
.log-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: #242424;
  color: #aaa;
  font-size: 12px; font-weight: 700;
  border-bottom: 1px solid #333;
  font-family: inherit;
}
.log-count { color: #666; font-weight: 400; margin-left: 4px; }
.log-actions { display: flex; gap: 6px; }
.log-actions button {
  background: none; border: 1px solid #444; color: #888;
  padding: 3px 9px; border-radius: 6px; font-size: 11px;
  cursor: pointer; font-family: monospace;
}
.log-actions button:hover { border-color: #666; color: #ccc; }
.log-entries {
  overflow-y: auto; flex: 1; padding: 6px 0;
  font-family: monospace; font-size: 11px; line-height: 1.6;
}
.log-empty { text-align: center; color: #444; padding: 24px; font-family: monospace; }
.log-entry {
  display: grid;
  grid-template-columns: 105px 1fr;
  gap: 6px;
  padding: 2px 14px;
  color: #666;
}
.log-entry.log-error { color: #e88; background: rgba(200,0,0,0.07); }
.log-entry.log-warn  { color: #f0c040; }
.log-entry.log-info  { color: #777; }
.log-ts  { color: #444; white-space: nowrap; }
.log-msg { word-break: break-word; }
.log-data { grid-column: 2; color: #5a9; font-size: 10px; margin-top: -3px; word-break: break-all; }
