:root {
  --green: #07833a;
  --green-dark: #055b2b;
  --bg: #eef6f0;
  --panel: #ffffff;
  --border: #cfe3d3;
  --text: #073b1b;
  --muted: #4a6354;
  --danger: #b42318;
  --ok: #027a48;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(120, 200, 140, 0.28), transparent 45%),
    radial-gradient(ellipse at 100% 30%, rgba(85, 170, 105, 0.18), transparent 40%),
    linear-gradient(160deg, #eef9f0, #f7fbf8 55%, #ffffff);
  color: var(--text);
  min-height: 100%;
}

body {
  padding: 16px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
}

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

.header h1 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--green);
  letter-spacing: 0.02em;
}

.status {
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
}

.status.ok { color: var(--ok); }
.status.err { color: var(--danger); }
.status.loading { color: #8a6d00; }

.grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

.panel h2 {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 1.1rem;
}

.panel h3 {
  margin: 16px 0 8px;
  font-size: 0.95rem;
  color: var(--green-dark);
}

label {
  font-weight: 700;
  display: block;
  margin: 10px 0 5px;
  font-size: 0.85rem;
}

input {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  background: #fff;
}

input:focus {
  outline: 2px solid rgba(7, 131, 58, 0.25);
  border-color: var(--green);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

button {
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: white;
  font-weight: 800;
  font-size: 15px;
  margin-top: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:active { transform: scale(0.99); }
button:disabled { opacity: 0.6; cursor: wait; }

button.secondary { background: #0b6f35; }
button.wa { background: #128c7e; }
button.ig {
  background: linear-gradient(45deg, #f58529, #dd2a7b 40%, #8134af 70%, #515bd4);
}
button.ghost {
  background: #fff;
  color: var(--green-dark);
  border: 1.5px solid var(--border);
}

.preview {
  position: sticky;
  top: 12px;
}

canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  background: white;
  display: block;
}

.hint {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .preview { position: static; order: -1; }
  body { padding: 12px; }
}
