/* De Malas Prontas — Criador de Artes v2 */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e7e9ee;
  --border-strong: #d5d9e1;
  --text: #0f172a;
  --text-2: #475467;
  --muted: #7a8599;
  --brand: #0b2a5b;
  --brand-600: #0e3672;
  --brand-50: #eef3fb;
  --accent: #ffc21a;
  --accent-50: #fff8e1;
  --success: #12b76a;
  --success-50: #ecfdf3;
  --danger: #e5484d;
  --danger-50: #fff1f1;
  --warning: #f79009;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 24px -6px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .05);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .22);
  --ring: 0 0 0 4px rgba(11, 42, 91, .12);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--ring); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: 60px; display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand); color: var(--accent); font-weight: 800; font-size: 13px;
}
.brand small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: -2px; }
.topbar .spacer { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  --h: 38px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .08s, color .15s;
  box-shadow: var(--shadow-xs);
}
.btn:hover { background: var(--surface-2); border-color: #c4cad5; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(11,42,91,.25), inset 0 1px 0 rgba(255,255,255,.08); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-whats { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-whats:hover { background: #15803d; border-color: #15803d; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: rgba(15, 23, 42, .05); border-color: transparent; color: var(--text); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-50); border-color: #f5c2c3; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #cf3a3f; border-color: #cf3a3f; }
.btn-lg { --h: 46px; padding: 0 20px; font-size: 14.5px; border-radius: 12px; }
.btn-sm { --h: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-icon { width: var(--h); padding: 0; }
.btn-block { width: 100%; }
.btn .kbd { margin-left: 4px; font-size: 11px; font-weight: 600; opacity: .7; border: 1px solid rgba(255,255,255,.3); border-radius: 5px; padding: 1px 5px; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Status chip ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--success); box-shadow: 0 0 0 3px rgba(18,183,106,.18); }
.dot.bad { background: var(--danger); box-shadow: 0 0 0 3px rgba(229,72,77,.18); }
.dot.warn { background: var(--warning); box-shadow: 0 0 0 3px rgba(247,144,9,.18); }
.dot.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Layout: creator ---------- */
.creator {
  max-width: 1320px; margin: 0 auto; padding: 28px 24px 120px;
  display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 28px; align-items: start;
}
.page-head { margin-bottom: 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; line-height: 1.2; letter-spacing: -.025em; margin: 0 0 4px; font-weight: 750; }
.page-head p { margin: 0; color: var(--text-2); }

.segmented {
  display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px;
  background: #eceef2; border: 1px solid var(--border);
}
.segmented button {
  height: 32px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent;
  font-weight: 600; font-size: 13px; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: background .15s, color .15s, box-shadow .15s;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented.sm button { height: 28px; padding: 0 10px; font-size: 12.5px; }

/* ---------- Cards / sections ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.form-section { padding: 20px 22px 22px; }
.form-section + .form-section { margin-top: 14px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; }
.section-title .num {
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; background: var(--brand-50); color: var(--brand);
}
.section-title h2 { font-size: 15px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.section-title .hint { margin-left: auto; color: var(--muted); font-size: 12.5px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: grid; gap: 14px; }

/* ---------- Fields ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text); }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.help { font-size: 12.5px; color: var(--muted); margin: 0; }
.link-btn { border: 0; background: none; padding: 0; color: var(--brand); font-weight: 600; font-size: 12.5px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface);
  transition: border-color .15s, box-shadow .15s; box-shadow: var(--shadow-xs);
}
.textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #a0a8b8; }
.input:hover, .select:hover, .textarea:hover { border-color: #c4cad5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(229,72,77,.12); }
.select {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237a8599' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group .prefix { position: absolute; left: 12px; color: var(--muted); font-weight: 600; pointer-events: none; }
.input-group .input { padding-left: 40px; font-variant-numeric: tabular-nums; }
.input-date { font-variant-numeric: tabular-nums; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 12.5px; font-weight: 600;
}
.pill svg { width: 14px; height: 14px; color: var(--muted); }
.pill.brand { background: var(--brand-50); border-color: #d6e1f3; color: var(--brand); }
.pill.brand svg { color: var(--brand); }

.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
  font-weight: 600; font-size: 13px; cursor: pointer; color: var(--text-2); transition: all .15s;
}
.choice:hover { border-color: #b8c0cd; color: var(--text); }
.choice[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-50); color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }

.price-preview {
  display: flex; align-items: baseline; gap: 6px; padding: 12px 14px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand) 0%, #15407f 100%); color: #fff;
}
.price-preview .lbl { font-size: 12px; opacity: .75; font-weight: 600; letter-spacing: .02em; }
.price-preview strong { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.price-preview .sfx { font-size: 12px; opacity: .75; margin-left: auto; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs button {
  position: relative; height: 38px; padding: 0 12px; border: 0; background: none; cursor: pointer;
  font-weight: 600; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px;
}
.tabs button svg { width: 15px; height: 15px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); }
.tabs .count { font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); padding: 0 6px; border-radius: 999px; color: var(--muted); }

/* ---------- Dropzone ---------- */
.dropzone {
  position: relative; display: grid; place-items: center; text-align: center; gap: 6px;
  min-height: 150px; padding: 22px; border-radius: 14px; cursor: pointer;
  border: 1.5px dashed var(--border-strong); background: var(--surface-2); transition: all .15s var(--ease);
}
.dropzone:hover { border-color: #9aa5b8; background: #f4f6f9; }
.dropzone.is-over { border-color: var(--brand); background: var(--brand-50); transform: scale(1.005); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .dz-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); color: var(--text-2); margin: 0 auto 4px; }
.dropzone .dz-icon svg { width: 20px; height: 20px; }
.dropzone strong { font-size: 13.5px; }
.dropzone strong span { color: var(--brand); }
.dropzone .help { margin: 0; }
.dropzone.compact { min-height: 0; padding: 14px; grid-template-columns: auto 1fr; text-align: left; gap: 12px; }
.dropzone.compact .dz-icon { margin: 0; }

.file-preview {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface);
}
.file-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.file-preview .meta { min-width: 0; flex: 1; }
.file-preview .meta strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.file-preview .meta span { color: var(--muted); font-size: 12.5px; }

/* ---------- Photo picker (Malai) ---------- */
.photo-toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
.photo-toolbar .input { height: 36px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; max-height: 340px; overflow: auto; padding: 2px; margin: -2px; }
.photo-tile {
  position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; cursor: pointer; padding: 0;
  border: 0; background: var(--surface-2); box-shadow: 0 0 0 1px var(--border);
  transition: box-shadow .15s, transform .15s var(--ease);
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s var(--ease); }
.photo-tile:hover img { transform: scale(1.04); }
.photo-tile .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 7px; text-align: left;
  font-size: 11px; font-weight: 600; color: #fff; line-height: 1.25;
  background: linear-gradient(transparent, rgba(0,0,0,.72));
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.photo-tile[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.photo-tile .check {
  position: absolute; top: 7px; right: 7px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand); color: #fff; opacity: 0; transform: scale(.6); transition: all .15s var(--ease);
}
.photo-tile .check svg { width: 13px; height: 13px; }
.photo-tile[aria-pressed="true"] .check { opacity: 1; transform: scale(1); }

/* ---------- Seal picker ---------- */
.checker {
  background-color: #fff;
  background-image: linear-gradient(45deg, #f0f2f5 25%, transparent 25%), linear-gradient(-45deg, #f0f2f5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f0f2f5 75%), linear-gradient(-45deg, transparent 75%, #f0f2f5 75%);
  background-size: 14px 14px; background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}
.seal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.seal-tile {
  position: relative; display: grid; gap: 0; padding: 0; overflow: hidden; text-align: left; cursor: pointer;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); transition: all .15s var(--ease);
}
.seal-tile:hover { border-color: #c4cad5; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.seal-tile .thumb { aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 10px; border-bottom: 1px solid var(--border); }
.seal-tile .thumb img { max-height: 100%; max-width: 100%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,.12)); }
.seal-tile .thumb.empty { color: var(--muted); font-size: 12px; font-weight: 600; }
.seal-tile .thumb.empty svg { width: 22px; height: 22px; margin: 0 auto 4px; display: block; }
.seal-tile .name { padding: 8px 10px; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seal-tile[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow-sm); }
.seal-tile .badge-default {
  position: absolute; top: 6px; left: 6px; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: var(--accent); color: #3d2c00;
}
.seal-tile .check {
  position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; opacity: 0; transform: scale(.6); transition: all .15s var(--ease);
}
.seal-tile .check svg { width: 12px; height: 12px; }
.seal-tile[aria-pressed="true"] .check { opacity: 1; transform: scale(1); }

/* ---------- Generate bar ---------- */
.generate-bar {
  position: sticky; bottom: 16px; z-index: 20; margin-top: 16px;
  display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 18px;
  background: rgba(255,255,255,.9); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-md);
}
.generate-bar .summary { min-width: 0; flex: 1; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.generate-bar .summary strong { color: var(--text); }

/* ---------- Preview panel ---------- */
.preview-panel { position: sticky; top: 84px; }
.preview-panel .card { overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 650; }
.panel-head .spacer { flex: 1; }
.stage {
  position: relative; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 50% 0%, #eef2f8, #e6eaf1 70%); min-height: 420px;
}
.frame {
  position: relative; width: 100%; max-width: 330px; border-radius: 14px; overflow: hidden;
  background: #dfe4ec; box-shadow: var(--shadow-lg); transition: aspect-ratio .3s var(--ease);
}
.frame.feed { aspect-ratio: 1080 / 1350; }
.frame.story { aspect-ratio: 1080 / 1920; max-width: 262px; }
.frame img { width: 100%; height: 100%; object-fit: cover; animation: fadeIn .4s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: scale(.985); } }
.frame .skeleton { position: absolute; inset: 0; background: linear-gradient(110deg, #dfe4ec 30%, #eef1f6 50%, #dfe4ec 70%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.frame .empty-state { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }
.frame .empty-state svg { width: 34px; height: 34px; margin: 0 auto 10px; color: #a0aabb; }
.frame .empty-state strong { display: block; color: var(--text-2); font-size: 13.5px; margin-bottom: 2px; }
.frame .empty-state span { font-size: 12.5px; }
.progress-overlay {
  position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 10px 12px; border-radius: 12px;
  background: rgba(15, 23, 42, .78); color: #fff; backdrop-filter: blur(8px); font-size: 12.5px; font-weight: 600;
}
.progress-overlay .bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,.2); margin-top: 8px; overflow: hidden; }
.progress-overlay .bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .4s var(--ease); }
.panel-actions { display: grid; gap: 8px; padding: 14px 16px 16px; border-top: 1px solid var(--border); }
.panel-actions .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.send-note { font-size: 12px; color: var(--muted); text-align: center; margin: 2px 0 0; }

.history { margin-top: 14px; padding: 14px 16px; }
.history-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.history-head h3 { margin: 0; font-size: 13.5px; font-weight: 650; }
.history-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.history-item { padding: 0; border: 0; background: var(--surface-2); border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 5; cursor: pointer; box-shadow: 0 0 0 1px var(--border); transition: transform .15s var(--ease), box-shadow .15s; }
.history-item:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-sm); }
.history-item img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Banner ---------- */
.banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; margin-bottom: 16px;
  background: var(--danger-50); border: 1px solid #f8c9ca; color: #8e1f23; font-size: 13.5px;
}
.banner svg { width: 18px; height: 18px; flex: none; }
.banner .grow { flex: 1; }
.banner.warn { background: var(--accent-50); border-color: #f6e0a0; color: #6b4b00; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px;
  background: #101828; color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px;
  animation: toastIn .3s var(--ease);
}
.toast.out { animation: toastOut .2s ease forwards; }
.toast .ic { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.toast .ic svg { width: 12px; height: 12px; }
.toast.success .ic { background: var(--success); }
.toast.error .ic { background: var(--danger); }
.toast.info .ic { background: #3b82f6; }
.toast strong { display: block; font-weight: 650; }
.toast span { color: #cbd2dc; font-size: 12.5px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px;
  background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(440px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: 20px;
  box-shadow: var(--shadow-lg); animation: pop .25s var(--ease);
}
.modal.xl { width: min(1040px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head { padding: 20px 22px 0; }
.modal-head h3 { margin: 0 0 4px; font-size: 17px; letter-spacing: -.01em; }
.modal-head p { margin: 0; color: var(--text-2); }
.modal-body { padding: 18px 22px; }
.modal-foot { padding: 14px 22px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 20px 20px; }
.lightbox { background: transparent; box-shadow: none; width: auto; max-width: min(92vw, 900px); display: grid; gap: 12px; justify-items: center; }
.lightbox img { max-height: 80vh; width: auto; border-radius: 14px; box-shadow: var(--shadow-lg); }
.lightbox .bar { display: flex; gap: 8px; }

/* ---------- Config layout ---------- */
.config { max-width: 1240px; margin: 0 auto; padding: 28px 24px 80px; display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 32px; align-items: start; }
.sidenav { position: sticky; top: 84px; display: grid; gap: 2px; }
.sidenav .nav-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 10px; }
.sidenav a {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: 10px;
  text-decoration: none; color: var(--text-2); font-weight: 600; font-size: 13.5px; transition: background .15s, color .15s;
}
.sidenav a svg { width: 17px; height: 17px; color: var(--muted); }
.sidenav a:hover { background: rgba(15,23,42,.04); color: var(--text); }
.sidenav a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.sidenav a[aria-current="page"] svg { color: var(--brand); }
.sidenav a .count { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.sidenav hr { border: 0; border-top: 1px solid var(--border); margin: 10px 4px; }

.config-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.config-head h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.02em; }
.config-head p { margin: 0; color: var(--text-2); max-width: 560px; }
.config-head .actions { display: flex; gap: 8px; }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; }
.asset-card { position: relative; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); overflow: hidden; transition: box-shadow .15s, transform .15s var(--ease); }
.asset-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.asset-card .media { aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 16px; border-bottom: 1px solid var(--border); }
.asset-card .media img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,.14)); }
.asset-card.photo .media { padding: 0; aspect-ratio: 4 / 3; }
.asset-card.photo .media img { width: 100%; height: 100%; object-fit: cover; filter: none; }
.asset-card .body { padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.asset-card .body .title { flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-card .body .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.asset-card .tag-default { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--accent); color: #3d2c00; box-shadow: var(--shadow-sm); }
.asset-card .tag-default svg { width: 11px; height: 11px; }
.asset-card .quick { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; opacity: 0; transform: translateY(-4px); transition: all .15s var(--ease); }
.asset-card:hover .quick, .asset-card:focus-within .quick { opacity: 1; transform: none; }
.asset-card .quick .btn { background: rgba(255,255,255,.95); }
.asset-add { border: 1.5px dashed var(--border-strong); background: var(--surface-2); display: grid; place-items: center; text-align: center; min-height: 100%; cursor: pointer; color: var(--text-2); padding: 20px; border-radius: 16px; position: relative; transition: all .15s; }
.asset-add:hover, .asset-add.is-over { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.asset-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.asset-add svg { width: 22px; height: 22px; margin: 0 auto 6px; display: block; }
.asset-add strong { display: block; font-size: 13.5px; }
.asset-add span { font-size: 12px; color: var(--muted); }

/* menu */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px; padding: 6px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); animation: pop .15s var(--ease);
}
.menu.up { top: auto; bottom: calc(100% + 6px); }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; font-size: 13.5px; font-weight: 500; text-align: left; color: var(--text); }
.menu button svg { width: 16px; height: 16px; color: var(--muted); }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }
.menu button.danger svg { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

.settings-card { padding: 0; }
.settings-row { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; padding: 20px 22px; }
.settings-row + .settings-row { border-top: 1px solid var(--border); }
.settings-row h4 { margin: 0 0 4px; font-size: 14px; }
.settings-row p { margin: 0; color: var(--muted); font-size: 13px; }

.color-field { display: flex; align-items: center; gap: 10px; }
.swatch { position: relative; width: 42px; height: 42px; border-radius: 10px; overflow: hidden; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.swatch input { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); border: 0; padding: 0; cursor: pointer; }
.color-field .input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; max-width: 140px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 22px; height: 22px; border-radius: 6px; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.14); }

.range { width: 100%; accent-color: var(--brand); }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output { min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; color: var(--text-2); }

.dirty-bar {
  position: sticky; bottom: 16px; z-index: 20; margin-top: 16px; display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 16px; border-radius: 14px; background: #101828; color: #fff; box-shadow: var(--shadow-lg); animation: toastIn .25s var(--ease);
}
.dirty-bar .grow { flex: 1; font-size: 13.5px; font-weight: 600; }
.dirty-bar .btn-ghost { color: #cbd2dc; }
.dirty-bar .btn-ghost:hover { color: #fff; background: rgba(255,255,255,.08); }

/* art mock (appearance preview) */
.art-mock { position: relative; aspect-ratio: 1080 / 1350; width: 100%; max-width: 300px; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-md); background: #9bb6cf center / cover; }
.art-mock .am-card { position: absolute; left: 12%; right: 12%; top: 40%; bottom: 14%; border-radius: 10px; padding: 18px 10px 10px; text-align: center; display: grid; align-content: start; gap: 6px; }
.art-mock .am-badge { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); padding: 3px 10px; border-radius: 5px; font-size: 9px; font-weight: 800; white-space: nowrap; color: #fff; }
.art-mock .am-label { font-size: 8.5px; font-weight: 800; }
.art-mock .am-text { font-size: 9px; font-weight: 600; }
.art-mock .am-price { font-size: 28px; font-weight: 900; letter-spacing: -.02em; line-height: 1; }
.art-mock .am-month { position: absolute; left: 50%; bottom: 10%; transform: translate(-50%, 50%); padding: 3px 12px; border-radius: 5px; font-size: 9px; font-weight: 800; color: #fff; white-space: nowrap; }
.art-mock .am-sep { height: 1px; margin: 2px 14px; }

/* seal editor */
.editor { display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: 560px; }
.editor-controls { padding: 20px 22px; border-right: 1px solid var(--border); display: grid; gap: 18px; align-content: start; }
.editor-stage { position: relative; display: grid; place-items: center; gap: 16px; padding: 24px; background: radial-gradient(circle at 50% 0%, #eef2f8, #e3e8ef 75%); grid-auto-flow: column; }
.editor-stage figure { margin: 0; display: grid; gap: 8px; justify-items: center; }
.editor-stage figcaption { font-size: 12px; font-weight: 600; color: var(--text-2); }
.editor-stage .frame { max-width: 270px; }
.editor-stage .frame.story { max-width: 215px; }
.editor-stage .frame.is-active { box-shadow: 0 0 0 3px var(--brand), var(--shadow-lg); }
.editor-stage .loading { position: absolute; top: 14px; right: 14px; }
.nudge { display: grid; grid-template-columns: repeat(3, 34px); grid-template-rows: repeat(3, 34px); gap: 4px; }
.nudge .btn { --h: 34px; width: 34px; padding: 0; }
.nudge .c { grid-column: 2; grid-row: 2; }
.nudge .u { grid-column: 2; grid-row: 1; }
.nudge .d { grid-column: 2; grid-row: 3; }
.nudge .l { grid-column: 1; grid-row: 2; }
.nudge .r { grid-column: 3; grid-row: 2; }
.xy { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.xy-values { display: grid; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.xy-values b { color: var(--text); font-variant-numeric: tabular-nums; }

/* whatsapp */
.wa-status { display: flex; align-items: center; gap: 16px; padding: 20px 22px; }
.wa-status .big-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--success-50); color: var(--success); flex: none; }
.wa-status .big-ic.bad { background: var(--danger-50); color: var(--danger); }
.wa-status .big-ic.warn { background: var(--accent-50); color: var(--warning); }
.wa-status .big-ic svg { width: 24px; height: 24px; }
.wa-status h3 { margin: 0; font-size: 16px; }
.wa-status p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.wa-status .grow { flex: 1; min-width: 0; }
.qr-box { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: center; padding: 20px 22px; border-top: 1px solid var(--border); }
.qr-box img { width: 220px; height: 220px; border-radius: 14px; border: 1px solid var(--border); background: #fff; padding: 8px; }
.qr-box ol { margin: 0; padding-left: 18px; color: var(--text-2); display: grid; gap: 6px; }
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 22px; }
.list-item + .list-item { border-top: 1px solid var(--border); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--brand-50); color: var(--brand); flex: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item strong { display: block; font-size: 13.5px; }
.list-item span { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.add-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 26px 0 10px; }

.empty-box { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty-box svg { width: 28px; height: 28px; margin: 0 auto 8px; color: #a0aabb; display: block; }
.empty-box strong { display: block; color: var(--text-2); }

/* login */
.login-wrap { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 24px; }
.login { width: min(380px, 100%); padding: 28px; }
.login .lock { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); margin-bottom: 14px; }
.login .lock svg { width: 22px; height: 22px; }
.login h1 { margin: 0 0 4px; font-size: 19px; }
.login p { margin: 0 0 18px; color: var(--text-2); }

.upload-progress { display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; background: var(--brand-50); color: var(--brand); font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.upload-progress .bar { height: 4px; border-radius: 4px; background: rgba(11,42,91,.15); overflow: hidden; }
.upload-progress .bar i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .creator { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  .config { grid-template-columns: 1fr; gap: 16px; }
  .sidenav { position: static; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .sidenav .nav-label, .sidenav hr { display: none; }
  .sidenav a { flex: none; }
  .editor { grid-template-columns: 1fr; }
  .editor-controls { border-right: 0; border-bottom: 1px solid var(--border); }
}
@media (max-width: 640px) {
  .topbar { padding: 0 14px; }
  .creator, .config { padding: 18px 14px 110px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-section { padding: 16px; }
  .settings-row { grid-template-columns: 1fr; gap: 12px; }
  .qr-box { grid-template-columns: 1fr; justify-items: center; }
  .add-row { grid-template-columns: 1fr; }
  .brand small { display: none; }
  .editor-stage { grid-auto-flow: row; }
  .generate-bar .summary { display: none; }
  .generate-bar .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* tamanhos de ícones em controles */
.segmented button svg, .chip svg, .choice svg, .link-btn svg, .sidenav svg, .input-group .prefix svg { width: 16px; height: 16px; flex: none; }
.segmented.sm button svg { width: 14px; height: 14px; }
.input-group .prefix { display: inline-flex; }

/* mídia sempre contida na proporção do card */
.asset-card .media, .seal-tile .thumb { overflow: hidden; min-height: 0; }
.asset-card .media img, .seal-tile .thumb img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; }
.asset-card.photo .media img { object-fit: cover; }
.asset-grid { align-items: start; }
.swatch { border: 1px solid var(--border-strong); }
