:root {
  --ink: #15161a;
  --muted: #6b6f7a;
  --line: #e4e5e9;
  --bg: #f7f7f5;
  --card: #ffffff;
  --accent: #1f4fd6;
  --danger: #b42318;
  --ok: #157f3b;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; background: var(--card); border-bottom: 1px solid var(--line);
}
.wordmark { font-weight: 750; font-size: 20px; letter-spacing: -0.02em; color: var(--ink); }
.nav { display: flex; align-items: center; gap: 16px; font-size: 14px; flex-wrap: wrap; }
.me { color: var(--muted); }

.app { max-width: 880px; margin: 0 auto; padding: 28px 20px 64px; }
h1 { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 6px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin: 16px 0;
}
.narrow { max-width: 420px; margin: 48px auto; }

label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=color], select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink);
}
input[type=color] { padding: 2px; height: 42px; }
textarea { min-height: 70px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

button, .button {
  display: inline-block; font: inherit; font-weight: 600; border: 0; border-radius: 8px;
  padding: 10px 16px; background: var(--ink); color: #fff; cursor: pointer; margin-top: 14px;
}
button.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
button.danger { background: #fff; color: var(--danger); border: 1px solid var(--line); }
button.link { background: none; color: var(--accent); padding: 0; margin: 0; font-weight: 500; }
button:disabled { opacity: 0.55; cursor: default; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list li:first-child { border-top: 0; }
.brand-chip { display: flex; align-items: center; gap: 12px; min-width: 0; }
.swatch { width: 36px; height: 36px; border-radius: 8px; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 700; overflow: hidden; }
.swatch img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }

.logo-preview { max-height: 56px; max-width: 220px; display: block; margin-top: 8px; }

/* Email preview */
.email-preview { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #f1f1ef; }
.email-preview .bar { padding: 18px 22px; color: #fff; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.email-preview .bar img { max-height: 32px; max-width: 160px; background: #fff; border-radius: 4px; padding: 2px; }
.email-preview .body { background: #fff; margin: 16px; border-radius: 10px; padding: 20px; }
.email-preview .cta { display: inline-block; color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 600; margin-top: 8px; }
.email-preview .foot { font-size: 12px; color: var(--muted); padding: 0 22px 16px; }

.error { color: var(--danger); font-size: 14px; margin-top: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; max-width: 90vw; }
.toast.bad { background: var(--danger); }
