:root {
  --red: #b71f2a;
  --red-dark: #7f1721;
  --gold: #f0b84e;
  --green: #1f7a55;
  --ink: #1f2328;
  --muted: #667085;
  --line: #e4e7ec;
  --paper: #fffaf2;
  --white: #ffffff;
  --soft: #f6f4ef;
  --danger: #a6372d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; min-width: 0; }
button { cursor: pointer; }

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

.menu-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 50;
  background: var(--red);
  color: white;
  border: 0;
  border-radius: 8px;
  width: 44px;
  height: 44px;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.sidebar {
  background: #fff6e6;
  border-right: 1px solid var(--line);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; gap: 16px; align-items: flex-start; }
.brand h1 { margin: 2px 0; font-size: 28px; line-height: 1; color: var(--red-dark); }
.brand span, .sidebar-note p, .eyebrow { color: var(--muted); display: block; }

.eyebrow { text-transform: uppercase; letter-spacing: 0; font-size: 12px; font-weight: 700; margin: 0 0 6px; }

.ai-indicator {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  margin-top: 6px;
}
.ai-indicator.on { background: #e7f5ee; color: var(--green); }
.ai-indicator.off { background: #fff0ee; color: var(--danger); }

.avatar { width: 84px; height: 104px; position: relative; flex: 0 0 auto; }

.photo-avatar {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #fff;
  background: #f6dcae;
  box-shadow: 0 8px 24px rgba(127,23,33,0.18);
  display: grid;
  place-items: center;
}

.photo-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 1; }
.photo-avatar span { position: absolute; inset: 0; display: grid; place-items: center; color: var(--red-dark); font-size: 24px; font-weight: 900; z-index: 0; }

.nav { display: grid; gap: 8px; }

.nav-item {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 700;
}

.nav-item.active, .nav-item:hover {
  background: var(--white);
  border-color: var(--line);
  color: var(--red-dark);
}

.sidebar-note {
  margin-top: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  font-size: 13px;
}
.sidebar-note p { margin: 6px 0; }

.content { padding: 32px; }

/* CLIENT BAR */
.client-bar {
  margin-bottom: 18px;
  padding: 18px 22px;
  background: linear-gradient(135deg, #fff6e6 0%, #ffe9c2 100%);
  border-color: #f3cf83;
}

.client-logged-out {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.client-logged-out strong {
  display: block;
  font-size: 18px;
  color: var(--red-dark);
  margin: 4px 0;
}

.client-logged {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.client-info {
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 0 0 auto;
}

.client-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--red);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 18px;
  border: 3px solid #ffd37a;
}

.client-info strong { display: block; font-size: 18px; color: var(--red-dark); }

.client-balance-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 280px;
  justify-content: center;
}

.balance-pill {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  text-align: center;
  flex: 1;
  min-width: 120px;
}

.balance-pill span { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.balance-pill strong { display: block; color: var(--green); font-size: 18px; margin-top: 4px; }

/* AUTH BAR */
.auth-bar {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(520px, 1.25fr);
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.auth-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 0.7fr) auto auto;
  gap: 10px;
  align-items: center;
}

.view { display: none; }
.view.active { display: block; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.topbar h2 { margin: 0; font-size: 28px; color: var(--red-dark); }

.grid { display: grid; gap: 18px; }
.two { grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.panel, .metric, .ad-strip, .ad-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.metric span { color: var(--muted); display: block; margin-bottom: 10px; font-size: 13px; }
.metric strong { font-size: 24px; color: var(--red-dark); }

label { display: grid; gap: 6px; color: var(--ink); font-weight: 700; font-size: 14px; }

textarea, input, select {
  width: 100%;
  border: 1px solid #cfd4dc;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
}

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

.recipe-input { display: grid; gap: 16px; }

.quick-share {
  background: #fff9ea;
  border: 1px solid #f3cf83;
  border-radius: 8px;
  padding: 16px;
}
.quick-share h3 { margin-top: 0; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.primary, .secondary, .reward-action {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 14px;
  font-weight: 800;
  transition: transform 0.1s, box-shadow 0.2s;
}

.primary:active, .secondary:active, .reward-action:active { transform: scale(0.97); }
.primary:disabled, .secondary:disabled, .reward-action:disabled { opacity: 0.6; cursor: wait; }

.primary { background: var(--red); color: white; }
.primary:hover:not(:disabled) { background: var(--red-dark); }
.secondary, .reward-action { background: var(--soft); color: var(--ink); border: 1px solid var(--line); }
.secondary:hover:not(:disabled), .reward-action:hover:not(:disabled) { background: #ebe8e1; }
.reward-action.done { background: #e7f5ee; color: var(--green); border-color: #b9dfcd; }

.cash-pill {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 180px;
}
.cash-pill span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.cash-pill strong { color: var(--green); font-size: 22px; }
.cash-pill.danger strong { color: var(--danger); }

.tt-message { display: grid; gap: 16px; align-content: start; }

.mini-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--red);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
  border: 4px solid #ffd37a;
}

.mini-avatar.photo-avatar {
  width: 64px;
  height: 64px;
  border-color: #ffd37a;
  background: #f6dcae;
}

blockquote { margin: 0; font-size: 18px; line-height: 1.4; color: var(--red-dark); font-weight: 700; }

.image-preview {
  min-height: 240px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f6d68e, #c74c43 55%, #6d2a1d);
  display: grid;
  place-items: center;
  color: white;
  font-size: 22px;
  font-weight: 900;
  text-align: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.image-preview.generated {
  background: radial-gradient(circle at 50% 38%, #fff3c4 0 16%, transparent 17%),
    radial-gradient(circle at 43% 46%, #f5b05f 0 7%, transparent 8%),
    radial-gradient(circle at 57% 49%, #e7674f 0 8%, transparent 9%),
    radial-gradient(circle at 51% 55%, #7cab5f 0 6%, transparent 7%),
    radial-gradient(circle at 50% 52%, #fff6dc 0 34%, transparent 35%),
    linear-gradient(135deg, #84281e, #d16b48);
}

.image-preview.has-photo {
  padding: 0;
  background: #1a1a1a;
}

.image-preview.has-photo img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
}

.image-preview.has-photo .img-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  padding: 30px 16px 16px;
  font-size: 16px;
  text-align: left;
}

.is-loading .image-preview::after {
  content: "Gerando foto com IA...";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: grid;
  place-items: center;
  color: white;
  font-size: 16px;
  font-weight: 700;
  z-index: 5;
}

.source-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  background: #e7f5ee;
  color: var(--green);
  border: 1px solid #b9dfcd;
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: 10px;
}
.source-badge.ai { background: #e9e3ff; color: #5733cb; border-color: #c7b8ff; }

.recipe-tip {
  background: #fff9ea;
  border-left: 4px solid var(--gold);
  padding: 12px 16px;
  border-radius: 6px;
  margin-top: 12px;
  font-size: 14px;
  color: #5f4932;
}
.recipe-tip strong { color: var(--red-dark); }

.result-panel { margin-top: 18px; }

.ad-strip {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #fff3d6;
  border-color: #f3cf83;
}
.ad-strip.compact { margin: 0 0 18px; }
.ad-strip strong, .ad-card strong { display: block; color: var(--red-dark); font-size: 18px; margin-bottom: 4px; }
.ad-strip p, .ad-card p { margin: 0; color: #5f4932; }

.ad-label {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 900;
  color: var(--red-dark);
  background: #ffe8a8;
  border: 1px solid #efc463;
  border-radius: 999px;
  padding: 4px 8px;
  margin-bottom: 8px;
}

.ad-card { margin-top: 16px; background: #f7fbf3; border-color: #cfe4bf; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.product-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.product-image {
  min-height: 110px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  text-align: center;
  padding: 16px;
}

.product-body { padding: 12px; }
.product-body strong { color: var(--red-dark); display: block; margin-bottom: 4px; }
.product-body span { color: var(--muted); font-size: 14px; }

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.result-header h3 { margin: 0; font-size: 22px; }

.status {
  background: #e7f5ee;
  color: var(--green);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.recipe-result { line-height: 1.55; color: #344054; }
.recipe-result ul, .recipe-result ol { margin-top: 8px; padding-left: 20px; }
.recipe-result li { margin-bottom: 6px; }

.feedback-box {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.feedback-box h4 { margin: 0 0 12px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.table-wrap { overflow-x: auto; }

table { width: 100%; min-width: 600px; border-collapse: collapse; }

th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
  font-size: 14px;
}

th { color: var(--red-dark); font-size: 12px; text-transform: uppercase; }

.simulator h3, .panel h3 { margin-top: 0; color: var(--red-dark); }

.summary-list { display: grid; gap: 10px; }
.summary-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.briefing li { margin-bottom: 10px; line-height: 1.45; }
.subtle { color: var(--muted); margin: 8px 0 0; line-height: 1.4; font-weight: 400; font-size: 13px; }

.table-action {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  font-weight: 800;
  margin: 2px;
  font-size: 12px;
}
.table-action.approve { background: #e7f5ee; color: var(--green); border-color: #b9dfcd; }
.table-action.reject { background: #fff0ee; color: var(--danger); border-color: #efc0bb; }

.status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
}
.status-pill.active { background: #e7f5ee; color: var(--green); }
.status-pill.blocked { background: #fff0ee; color: var(--danger); }

/* MODAL */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.modal.show { display: flex; }

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 28px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
  display: grid;
  gap: 14px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 {
  margin: 0;
  color: var(--red-dark);
  font-size: 22px;
  padding-right: 30px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: 0;
  font-size: 28px;
  color: var(--muted);
  width: 36px;
  height: 36px;
  line-height: 1;
  border-radius: 50%;
}
.modal-close:hover { background: var(--soft); color: var(--ink); }

.modal-content a { color: var(--red); font-weight: 700; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink);
  color: white;
  padding: 14px 22px;
  border-radius: 10px;
  font-weight: 700;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  opacity: 0;
  transition: all 0.3s;
  max-width: 90%;
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--green); }
.toast.error { background: var(--danger); }

/* RESPONSIVE */
@media (max-width: 980px) {
  .menu-toggle { display: block; }

  .app-shell { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 40;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
  }
  .sidebar.mobile-open { transform: translateX(0); }

  .content { padding: 70px 16px 24px; }

  .two, .three, .four { grid-template-columns: 1fr; }

  .topbar { align-items: stretch; flex-direction: column; }

  .ad-strip { align-items: stretch; flex-direction: column; }

  .auth-bar, .auth-fields { grid-template-columns: 1fr; align-items: stretch; }

  .client-logged-out, .client-logged { flex-direction: column; align-items: stretch; }
  .client-balance-grid { justify-content: stretch; }
}

@media (max-width: 640px) {
  html, body { overflow-x: hidden; }

  .content { padding: 64px 14px 24px; }

  .brand { align-items: flex-start; }

  .topbar h2 { font-size: 24px; }

  table { font-size: 13px; min-width: 500px; }

  .panel, .metric, .ad-strip, .ad-card { padding: 16px; }

  .brand h1 { font-size: 24px; }

  th, td { padding: 8px; }

  .actions { align-items: stretch; flex-direction: column; }
  .actions button, .primary, .secondary, .reward-action { width: 100%; }

  .modal-content { padding: 22px 18px; }
  .modal-content h2 { font-size: 19px; }

  .image-preview { min-height: 200px; font-size: 18px; }
  .image-preview.has-photo img { height: 240px; }
}

@media (min-width: 981px) and (max-width: 1180px) {
  .four { grid-template-columns: repeat(2, 1fr); }
}

/* Scroll suave para navegacao */
/* PAINEL DE VANTAGENS */
.vantagens-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff9ea;
  border: 1px solid #f3cf83;
  color: var(--red-dark);
  font-weight: 800;
  font-size: 14px;
  padding: 12px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.vantagens-trigger:hover { background: #ffeeb8; }
.vantagens-trigger .chevron { transition: transform 0.3s; font-size: 12px; }
.vantagens-trigger.open .chevron { transform: rotate(180deg); }

.vantagens-panel {
  display: none;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  overflow: hidden;
}
.vantagens-panel.show { display: block; }

.vantagens-header {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: white;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.vantagens-header h3 { margin: 0; font-size: 16px; }
.vantagens-header .total-pill {
  background: rgba(255,255,255,0.2);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.vantagens-list { padding: 8px; }

.vantagem-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.vantagem-item:last-child { border-bottom: 0; }

.vantagem-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 16px;
  flex: 0 0 auto;
}
.vantagem-icon.verde { background: #e7f5ee; color: var(--green); }
.vantagem-icon.laranja { background: #fff9ea; color: #b8860b; }
.vantagem-icon.roxo { background: #e9e3ff; color: #5733cb; }

.vantagem-texto { flex: 1; }
.vantagem-texto strong { display: block; color: var(--ink); font-size: 14px; }
.vantagem-texto span { color: var(--muted); font-size: 12px; }

.vantagem-valor {
  text-align: right;
  min-width: 90px;
}
.vantagem-valor .moeda {
  display: block;
  font-size: 15px;
  font-weight: 900;
  color: var(--green);
}
.vantagem-valor .pts {
  font-size: 11px;
  color: var(--muted);
}

.vantagens-footer {
  background: #f6f4ef;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.vantagens-footer .teto { color: var(--muted); }
.vantagens-footer .acumulado { font-weight: 800; color: var(--red-dark); }

/* BOTOES DE ACAO SIMPLES (sem valor exposto) */
.acao-simples {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.acao-btn {
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.acao-btn:hover { border-color: var(--red); background: #fff9ea; }
.acao-btn.feito { background: #e7f5ee; border-color: var(--green); color: var(--green); }

