/* AdCloner. System sans everywhere, hierarchy by weight and size. One accent, used for actions. */

:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --alt: #f2f1ec;
  --text: #121212;
  --muted: #64635e;
  --line: #e4e3dd;
  --accent: #5b4bff;
  --accent-hover: #4a3af0;
  --accent-ink: #ffffff;
  --accent-soft: #ecebff;
  --danger: #c7322b;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 28px rgb(0 0 0 / 0.07);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --surface: #1a1a18;
    --alt: #161615;
    --text: #f1f0ec;
    --muted: #a3a29c;
    --line: #2c2c29;
    --accent: #8b80ff;
    --accent-hover: #9d94ff;
    --accent-ink: #0f0d2a;
    --accent-soft: #24224a;
    --danger: #ff6b63;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 28px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.12; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 800; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 750; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0; }
a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
.narrow { max-width: 640px; }
.center { text-align: center; }

/* ---- Buttons and forms ---- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 650; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.7; cursor: progress; }
.btn-small { min-height: 38px; padding: 0 16px; border-radius: 10px; font-size: 0.92rem; }
.btn:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.join { display: flex; gap: 8px; max-width: 480px; }
.join input[type="email"] {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text);
  font: inherit;
}
.join input[type="email"]::placeholder { color: var(--muted); }
.join.is-busy { cursor: progress; }
.join.is-busy input { opacity: 0.7; }
@media (max-width: 480px) {
  .join { flex-direction: column; }
}

.fine { margin-top: 10px; color: var(--muted); font-size: 0.88rem; }
.form-error { margin-top: 10px; color: var(--danger); font-weight: 600; font-size: 0.95rem; }
.joined {
  max-width: 480px; padding: 14px 18px; border-radius: 12px;
  background: var(--accent-soft); color: var(--text);
}

/* ---- Top bar ---- */

.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; letter-spacing: -0.02em; text-decoration: none; }
.top-nav { display: flex; align-items: center; gap: 22px; font-size: 0.95rem; }
.top-nav a:not(.btn) { color: var(--muted); text-decoration: none; }
.top-nav a:not(.btn):hover { color: var(--text); }
@media (max-width: 640px) { .top-nav { gap: 14px; } .top-nav a:not(.btn):not(.nav-keep) { display: none; } }

/* ---- Hero ---- */

.hero { padding: 56px 0 72px; }
.hero-grid { display: grid; gap: 48px; align-items: center; }
@media (min-width: 980px) {
  .hero { padding: 88px 0 104px; }
  .hero-grid { grid-template-columns: 1fr 1.05fr; gap: 56px; }
}
.hero-copy { display: grid; gap: 20px; }
.eyebrow { color: var(--accent); font-weight: 700; font-size: 0.92rem; }
.lede { color: var(--muted); font-size: 1.15rem; max-width: 34em; }
#join { margin-top: 8px; scroll-margin-top: 96px; }

/* The demo: two mock ads built in CSS, the second is the first one cloned for another brand. */
.demo {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 24px; border-radius: 24px; background: var(--alt); border: 1px solid var(--line);
}
.demo-ad { margin: 0; display: grid; gap: 10px; }
.demo-ad figcaption { font-size: 0.82rem; font-weight: 650; color: var(--muted); }
.demo-arrow { color: var(--accent); }

.ad {
  --ink: #2b1606; --paper: #ffe7d1; --pop: #ff6a1a; --pop2: #ffb347;
  aspect-ratio: 4 / 5; padding: 9%; border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; gap: 6%;
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow);
  container-type: inline-size;
}
.ad-cool { --ink: #120f3a; --paper: #e6e3ff; --pop: #5b4bff; --pop2: #22c4a6; }
.ad-badge {
  align-self: flex-start; padding: 0.4em 0.75em; border-radius: 99px;
  background: var(--ink); color: var(--paper);
  font-size: max(9px, 6.4cqw); font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
}
.ad-head { font-size: max(13px, 11.5cqw); font-weight: 850; line-height: 1.02; letter-spacing: -0.03em; }
/* Shapes are sized by the art box height, so they never spill into the headline or CTA. */
.ad-art { flex: 1; position: relative; min-height: 40px; }
.ad-art i { position: absolute; border-radius: 50%; aspect-ratio: 1; }
.ad-art i:nth-child(1) { height: 92%; right: 4%; bottom: 0; background: var(--pop); }
.ad-art i:nth-child(2) { height: 50%; left: 6%; bottom: 6%; background: var(--pop2); }
.ad-art i:nth-child(3) { height: 26%; left: 34%; top: 4%; background: var(--ink); opacity: 0.85; }
.ad-cool .ad-art i { border-radius: 26%; }
.ad-cta {
  align-self: stretch; text-align: center; padding: 0.7em; border-radius: 0.6em;
  background: var(--pop); color: #fff; font-size: max(10px, 6.8cqw); font-weight: 800;
}

.sizes {
  grid-column: 1 / -1; list-style: none; margin: 8px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.sizes li {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px;
  border-radius: 99px; background: var(--surface); border: 1px solid var(--line);
  font-size: 0.82rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.ratio { display: inline-block; height: 16px; aspect-ratio: var(--w) / var(--h); border: 1.6px solid var(--accent); border-radius: 3px; }

@media (max-width: 520px) {
  .demo { padding: 16px; gap: 8px; }
  .demo-arrow svg { width: 26px; height: 26px; }
}

/* ---- Sections ---- */

.section { padding: 72px 0; }
@media (min-width: 980px) { .section { padding: 104px 0; } }
.section-alt { background: var(--alt); border-block: 1px solid var(--line); }
.section h2 { max-width: 20em; }
.section-lede { margin-top: 14px; color: var(--muted); font-size: 1.08rem; max-width: 40em; }
.section h1 + .lede { margin-top: 16px; }
.section .lede + p { margin-top: 28px; }

.steps { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 16px; }
@media (min-width: 820px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
.steps li {
  display: grid; gap: 10px; align-content: start; padding: 26px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
}
.steps p { color: var(--muted); }
.step-n {
  display: inline-grid; place-items: center; width: 34px; height: 34px; margin-bottom: 6px;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 800;
}

.placements {
  list-style: none; margin: 40px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
@media (min-width: 640px) { .placements { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.placements li {
  display: grid; justify-items: start; align-content: end; gap: 2px;
  padding: 18px; min-height: 180px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.placements small { color: var(--muted); font-variant-numeric: tabular-nums; }
.frame {
  /* 88px tall, unless that's wider than the tile: then shrink and keep the ratio. */
  width: min(100%, calc(88px * var(--w) / var(--h))); aspect-ratio: var(--w) / var(--h); margin-bottom: 14px;
  border-radius: 8px; border: 2px solid var(--text);
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%);
}

.split { display: grid; gap: 32px; align-items: center; }
@media (min-width: 900px) { .split { grid-template-columns: 1.1fr 1fr; gap: 64px; } }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.checks li {
  position: relative; padding: 16px 18px 16px 50px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-weight: 550;
}
.checks li::before {
  content: ""; position: absolute; left: 18px; top: 50%; width: 18px; height: 18px; margin-top: -9px;
  border-radius: 6px; background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4.5 9.5l3 3 6-7' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}

.plans { margin-top: 40px; display: grid; gap: 16px; }
@media (min-width: 860px) { .plans { grid-template-columns: repeat(3, 1fr); } }
.plan {
  display: grid; gap: 14px; align-content: start; padding: 28px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
}
.plan-featured { border: 2px solid var(--accent); box-shadow: var(--shadow); }
.price { color: var(--muted); }
.price b { color: var(--text); font-size: 2.2rem; font-weight: 800; letter-spacing: -0.03em; margin-right: 4px; }
.plan ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--muted); }
.plans + .fine { margin-top: 20px; }

.cta-inner { display: grid; justify-items: center; text-align: center; gap: 0; }
.cta-inner .section-lede { margin: 14px 0 28px; }
.cta-inner .join { width: 100%; }

/* ---- Footer ---- */

.foot { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: 0.9rem; }
.foot-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ======== Library (app pages) ======== */

.js .no-js-only { display: none; }
.muted { color: var(--muted); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--alt); }

.lib-bar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.lib-bar-inner { display: flex; align-items: center; gap: 14px; padding: 10px 16px; flex-wrap: wrap; }
@media (min-width: 720px) { .lib-bar-inner { padding: 12px 24px; flex-wrap: nowrap; } }
.lib-bar .logo { flex: none; }
.lib-filters { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap; }
.lib-search {
  flex: 1 1 220px; min-width: 0; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted);
}
.lib-search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font: inherit; outline: none; }
.lib-search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.lib-select select {
  height: 40px; padding: 0 30px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.92rem; appearance: none; max-width: 190px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2364635e' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
/* Phone: logo and Admin on top, full-width search, then the four filters as a 2x2 grid. */
@media (max-width: 719px) {
  .lib-bar .logo { order: 1; }
  .lib-nav { order: 2; margin-left: auto; }
  .lib-filters { order: 3; flex-basis: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .lib-search { grid-column: 1 / -1; }
  .lib-select select { width: 100%; max-width: none; }
  .pop-trigger { width: 100%; }
}
.lib-nav { display: flex; align-items: center; gap: 14px; flex: none; }
.lib-nav a { color: var(--muted); font-size: 0.92rem; text-decoration: none; white-space: nowrap; }
.lib-nav a:hover { color: var(--text); }
@media (max-width: 719px) { .lib-nav a:not(.lib-admin):first-child { display: none; } }

.pop { position: relative; }
.pop-trigger {
  list-style: none; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 0.92rem; user-select: none;
}
.pop-trigger::-webkit-details-marker { display: none; }
.pop-trigger.is-active { border-color: var(--accent); }
.dot { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15); }
.pop-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 248px; padding: 14px; display: grid; gap: 12px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
@media (max-width: 719px) { .pop-panel { right: 0; left: auto; } }
.pop-title { font-weight: 650; font-size: 0.9rem; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span:first-of-type { display: block; aspect-ratio: 1; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15); }
.swatch input:checked + span { outline: 2px solid var(--text); outline-offset: 2px; }
.swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.custom-color { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.9rem; color: var(--muted); }
.custom-color input { width: 44px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }
.pop-clear { font-size: 0.9rem; color: var(--accent); }

.lib-main { padding: 20px 16px 64px; max-width: 1600px; margin: 0 auto; }
@media (min-width: 720px) { .lib-main { padding: 24px 24px 80px; } }
.lib-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.lib-head h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.lib-reset { color: var(--accent); font-size: 0.92rem; }

/* Masonry with CSS columns: ads keep their real aspect ratio. */
.lib-grid { columns: 2 160px; column-gap: 14px; }
@media (min-width: 720px) { .lib-grid { columns: 4 220px; column-gap: 18px; } }
.card {
  display: block; break-inside: avoid; margin-bottom: 18px; position: relative; text-decoration: none; color: inherit;
}
.card img {
  display: block; width: 100%; height: auto; border-radius: 10px; background: var(--alt);
  box-shadow: 0 0 0 1px var(--line); transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover img { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--line), var(--shadow); }
.card-info { display: grid; gap: 1px; padding: 8px 2px 0; min-width: 0; }
.card-info b { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-info small { color: var(--muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-dots { position: absolute; top: 8px; right: 8px; display: flex; gap: 3px; padding: 4px; border-radius: 99px; background: var(--surface); opacity: 0; transition: opacity 0.15s ease; }
.card:hover .card-dots, .card:focus-visible .card-dots { opacity: 1; }
.card-dots i { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12); }
.lib-more { display: flex; justify-content: center; margin-top: 12px; }
.lib-empty { max-width: 460px; margin: 64px auto; text-align: center; display: grid; gap: 12px; }
.lib-empty h2 { font-size: 1.4rem; }
.lib-empty p { color: var(--muted); }

.lib-back { margin-bottom: 16px; font-size: 0.92rem; }
.lib-back a { color: var(--muted); text-decoration: none; }
.lib-back a:hover { color: var(--text); }
.detail { display: grid; gap: 28px; align-items: start; }
@media (min-width: 960px) { .detail { grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 40px; } }
.detail-stage { display: grid; place-items: center; padding: 20px; border-radius: 18px; background: var(--alt); border: 1px solid var(--line); }
@media (min-width: 960px) { .detail-stage { position: sticky; top: 84px; padding: 32px; } }
.detail-stage img { max-width: 100%; max-height: 78vh; width: auto; height: auto; border-radius: 8px; box-shadow: var(--shadow); }
.detail-side { display: grid; gap: 22px; }
.detail-side h1 { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 750; }
.detail-side h2 { font-size: 0.82rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.detail-cta { display: grid; gap: 4px; justify-items: start; }
.detail-cta .fine { margin-top: 2px; }
.facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border-radius: 12px; overflow: hidden; background: var(--line); border: 1px solid var(--line); }
.facts div { background: var(--surface); padding: 10px 14px; }
.facts dt { font-size: 0.78rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-size: 0.88rem; }
.chip:hover { border-color: var(--text); }
.chip-soft { background: var(--alt); }
.chip-color {
  display: inline-flex; gap: 6px; align-items: center; padding: 5px 12px; border-radius: 99px; color: #fff; text-decoration: none;
  font-size: 0.82rem; font-weight: 600; font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12);
}
.chip-color.is-light { color: #121212; }
.chip-color small { opacity: 0.75; }
.blocks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.blocks li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.blocks span { font-size: 0.75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.detail-links { display: flex; gap: 16px; font-size: 0.92rem; }
.detail-links a { color: var(--muted); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 0.82rem; font-weight: 600; }
.pill-draft { background: #fff1c2; color: #7a5a00; justify-self: start; }
.similar { margin-top: 56px; }
.similar h2 { font-size: 1.15rem; margin-bottom: 16px; }

/* ======== Signed-in app ======== */

.small { font-size: 0.86rem; }
.app-bar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.app-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; max-width: 1280px; margin: 0 auto; }
@media (min-width: 720px) { .app-bar-inner { padding: 12px 24px; } }
@media (max-width: 559px) { .app-bar .logo-text { display: none; } }
.app-nav { display: flex; align-items: center; gap: 4px; min-width: 0; }
.app-nav > a { padding: 8px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 0.94rem; white-space: nowrap; }
.app-nav > a:hover { color: var(--text); background: var(--alt); }
.app-nav > a[aria-current="page"] { color: var(--text); font-weight: 650; }
.credits {
  display: inline-flex; align-items: center; height: 30px; padding: 0 10px; border-radius: 99px; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent); font-size: 0.84rem; font-weight: 650; font-variant-numeric: tabular-nums;
}
@media (max-width: 559px) { .app-nav > a { padding: 8px 6px; font-size: 0.88rem; } .app-nav .credits { display: none; } }
.account .pop-trigger { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 50%; font-weight: 700; }
.pop-right { width: 260px; }
.pop-panel form { margin: 0; }
button.link { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.muted-link { color: var(--muted); }

.app-main { padding: 24px 16px 80px; max-width: 1280px; margin: 0 auto; }
@media (min-width: 720px) { .app-main { padding: 32px 24px 96px; } }
.app-main h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 750; letter-spacing: -0.025em; }
.app-main h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.app-main h3 { font-size: 0.95rem; font-weight: 650; margin: 16px 0 8px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head p { margin-top: 6px; }
.page-head a { color: inherit; }
.page-head .btn { color: var(--accent-ink); }
.page-head .btn-secondary { color: var(--text); }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.back { margin-bottom: 14px; font-size: 0.92rem; }
.back a { color: var(--muted); text-decoration: none; }
.back a:hover { color: var(--text); }
.eyebrow { color: var(--accent); font-weight: 650; font-size: 0.88rem; margin-bottom: 8px; }
.narrow-page { max-width: 560px; margin: 0 auto; display: grid; gap: 18px; }
.narrow-page > .muted { margin-top: -6px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
@media (min-width: 720px) { .panel { padding: 22px; } }
.panel > h2 { margin-bottom: 14px; }
.stack { display: grid; gap: 14px; }
.row { display: grid; gap: 14px; }
@media (min-width: 560px) { .row { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); } }
.grid-2 { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 0.92rem; min-width: 0; }
.field .muted { font-weight: 400; }
.field input, .field textarea, .field select {
  width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit; font-weight: 400; font-size: 1rem;
}
.field textarea { resize: vertical; line-height: 1.45; }
.field select { height: 44px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.is-busy input, .is-busy textarea { opacity: 0.7; }
fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-weight: 400; cursor: pointer; }
.choice + .choice { margin-top: 6px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 4px; accent-color: var(--accent); }
.choice span { display: grid; }
.choice small { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn-secondary:hover { background: var(--alt); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.1); }
.summary { cursor: pointer; font-weight: 650; }
details.panel > summary { cursor: pointer; }
details.panel[open] > summary { margin-bottom: 14px; }

.flash { margin: 0 0 18px; padding: 12px 16px; border-radius: 12px; background: var(--accent-soft); }
.flash p + p { margin-top: 4px; }
.pre-line { white-space: pre-line; }
.flash-error { background: #fde0d8; color: #8a250a; }
.flash-warn { background: #fff1c2; color: #5c4400; }
@media (prefers-color-scheme: dark) {
  .flash-error { background: #3d1a12; color: #ffb4a0; }
  .flash-warn { background: #3a3010; color: #ffe08a; }
}

.empty { max-width: 460px; margin: 48px auto; text-align: center; display: grid; gap: 12px; }
.empty p { color: var(--muted); }

.progress-panel { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.spinner { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgb(0 0 0 / 0.45); padding: 16px; }
.overlay[hidden] { display: none; }
.overlay-card { background: var(--surface); border-radius: 16px; padding: 28px; width: min(380px, 100%); display: grid; gap: 14px; justify-items: center; text-align: center; box-shadow: var(--shadow); }
.overlay-card p { font-weight: 600; }

/* Businesses */
.biz-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.biz-card {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; transition: box-shadow 0.15s ease;
}
.biz-card:hover { box-shadow: var(--shadow); }
.biz-card .card-dots { opacity: 1; position: static; margin-left: auto; padding: 0; background: none; }
.biz-logo, .avatar {
  flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; overflow: hidden;
  background: var(--alt); border: 1px solid var(--line); font-weight: 750; font-size: 1.1rem;
}
.biz-logo img, .avatar img { width: 100%; height: 100%; object-fit: contain; }
.biz-info { display: grid; min-width: 0; }
.biz-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-info small { color: var(--muted); }
.biz-layout { display: grid; gap: 20px; align-items: start; }
@media (min-width: 960px) { .biz-layout { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); } }
.biz-side { display: grid; gap: 20px; }
.color-input { display: flex; align-items: center; gap: 6px; }
.color-input i { flex: none; width: 22px; height: 22px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15); }
.color-input input { flex: 1; }
.assets { display: flex; flex-wrap: wrap; gap: 10px; }
.asset { position: relative; margin: 0; width: 92px; height: 92px; border-radius: 12px; overflow: hidden; background: var(--alt); border: 1px solid var(--line); }
.asset img { width: 100%; height: 100%; object-fit: cover; }
.asset-logo img { object-fit: contain; padding: 8px; }
.asset form { position: absolute; top: 4px; right: 4px; }
.asset-remove { width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgb(0 0 0 / 0.6); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.asset-add { display: flex; flex-direction: column; gap: 6px; }
.asset-drop {
  position: relative; display: grid; place-items: center; width: 92px; height: 92px; border-radius: 12px; cursor: pointer;
  border: 1.5px dashed var(--line); color: var(--muted); font-size: 0.85rem; text-align: center; padding: 6px;
}
.asset-drop:hover, .asset-drop:focus-within { border-color: var(--accent); color: var(--accent); }
.asset-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.danger-zone { margin-top: 14px; }
.danger-zone summary { list-style: none; color: var(--danger); text-decoration: underline; cursor: pointer; font-size: 0.92rem; }
.danger-zone summary::-webkit-details-marker { display: none; }
.danger-zone form { display: grid; gap: 10px; justify-items: start; margin-top: 10px; }
button.danger { color: var(--danger); }
.panel form + p, .panel form p { margin-top: 4px; }
.audiences { margin-top: 32px; display: grid; gap: 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.audience > summary { display: grid; gap: 2px; list-style: none; }
.audience > summary::-webkit-details-marker { display: none; }
.audience > summary .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audience[open] > summary .muted { white-space: normal; }
.audience-delete { margin-top: 12px; }

/* Clone */
.clone { display: grid; gap: 28px; align-items: start; }
@media (min-width: 900px) { .clone { grid-template-columns: minmax(0, 1fr) minmax(340px, 1fr); gap: 40px; } }
.clone-ref { margin: 0; display: grid; gap: 14px; padding: 18px; border-radius: 18px; background: var(--alt); border: 1px solid var(--line); }
.clone-ref img { display: block; max-width: 100%; max-height: 60vh; width: auto; height: auto; margin: 0 auto; border-radius: 8px; box-shadow: var(--shadow); }
.clone-ref figcaption { display: grid; gap: 10px; }
.clone-form { display: grid; gap: 16px; }
.clone-form > .muted { margin-top: -8px; }
.clone-submit { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.is-short { color: var(--danger); font-weight: 600; }

/* Creatives */
.job-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.job-card { display: block; text-decoration: none; color: inherit; }
.job-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; border-radius: 12px; background: var(--alt); border: 1px solid var(--line); }
.job-thumbs img, .job-thumb-empty { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 6px; background: var(--surface); }
.job-thumb-empty { display: grid; place-items: center; color: var(--muted); font-size: 0.85rem; }
.job-card:hover .job-thumbs { box-shadow: var(--shadow); }
.variant-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.variant-card { display: block; text-decoration: none; color: inherit; }
.variant-card img { display: block; width: 100%; height: auto; border-radius: 10px; background: var(--alt); box-shadow: 0 0 0 1px var(--line); }
.variant-card:hover img { box-shadow: 0 0 0 1px var(--line), var(--shadow); }
.variant-empty { display: grid; place-items: center; align-content: center; gap: 8px; aspect-ratio: 2 / 3; padding: 16px; text-align: center; border-radius: 10px; border: 1.5px dashed var(--line); }

/* Variant: previews and downloads */
.variant-layout { display: grid; gap: 28px; align-items: start; }
@media (min-width: 960px) { .variant-layout { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 40px; } }
.variant-side { display: grid; gap: 20px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tabs > input { position: absolute; opacity: 0; pointer-events: none; }
.tabs > label { padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 0.88rem; cursor: pointer; }
.tabs > input:checked + label { background: var(--text); color: var(--bg); border-color: var(--text); }
.tabs > input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabs > .safe-label { margin-left: auto; border-style: dashed; }
.tab-panel { display: none; flex-basis: 100%; }
#p-fb:checked ~ [data-tab="p-fb"], #p-ig:checked ~ [data-tab="p-ig"], #p-story:checked ~ [data-tab="p-story"], #p-reel:checked ~ [data-tab="p-reel"] { display: block; }

.phone {
  width: 100%; max-width: 380px; margin: 18px auto 0; border-radius: 34px; padding: 10px; background: #0b0b0b;
  box-shadow: 0 0 0 1px #2a2a2a, var(--shadow);
}
.phone > div { border-radius: 26px; overflow: hidden; background: #fff; color: #050505; font-size: 14px; line-height: 1.35; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 12px; }
.post-head .avatar { width: 36px; height: 36px; border-radius: 50%; font-size: 0.9rem; background: #f0f0f0; border-color: #e4e4e4; }
.post-head > span:nth-child(2) { display: grid; min-width: 0; }
.post-head b { font-size: 14px; }
.post-head small { color: #65676b; font-size: 12px; display: flex; gap: 4px; align-items: center; }
.post-head .dots { margin-left: auto; color: #65676b; font-weight: 700; }
.post-text { padding: 0 12px 10px; white-space: pre-line; overflow-wrap: anywhere; }
.see-more { color: #65676b; font-weight: 600; }
.post-image { display: block; width: 100%; object-fit: cover; background: #eee; }
.ratio-45 { aspect-ratio: 4 / 5; }
.fb-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #f0f2f5; }
.fb-link > span:first-child { display: grid; flex: 1; min-width: 0; }
.fb-link small { color: #65676b; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-link b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-cta { flex: none; padding: 7px 12px; border-radius: 6px; background: #e4e6eb; font-weight: 600; font-size: 14px; }
.fb-actions { display: flex; justify-content: space-around; padding: 10px; border-top: 1px solid #e4e6eb; color: #65676b; font-weight: 600; }
.avatar.ring { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #d62976; }
.ig-cta { display: flex; justify-content: space-between; padding: 11px 12px; background: #3797f0; color: #fff; font-weight: 600; }
.ig-icons { display: flex; gap: 14px; padding: 10px 12px 6px; }
.ig .post-text { padding-top: 0; }
.tall > div { position: relative; aspect-ratio: 9 / 16; background: #000; color: #fff; }
.story img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.story-bar { position: absolute; top: 10px; left: 10px; right: 10px; height: 3px; border-radius: 3px; background: rgb(255 255 255 / 0.4); }
.story-bar i { display: block; width: 35%; height: 100%; border-radius: 3px; background: #fff; }
.story-head { position: absolute; top: 22px; left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; text-shadow: 0 1px 3px rgb(0 0 0 / 0.5); }
.story-head .avatar { width: 30px; height: 30px; border-radius: 50%; font-size: 0.8rem; color: #050505; background: #fff; border: 0; }
.story-head small { opacity: 0.85; }
.story-cta {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 2px;
  padding: 8px 18px; border-radius: 99px; background: #fff; color: #050505; font-weight: 650; white-space: nowrap;
}
.story-cta span { line-height: 0.6; }
.reel-rail { position: absolute; right: 10px; bottom: 120px; display: grid; gap: 18px; font-size: 22px; text-align: center; text-shadow: 0 1px 3px rgb(0 0 0 / 0.5); }
.reel-foot { position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 8px; padding: 40px 56px 18px 12px; background: linear-gradient(transparent, rgb(0 0 0 / 0.6)); }
.reel-foot .story-head { position: static; }
.reel-foot p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reel-cta { justify-self: start; padding: 7px 14px; border-radius: 8px; background: rgb(255 255 255 / 0.25); font-weight: 650; backdrop-filter: blur(6px); }
/* Meta's guidance: keep key text out of the top 14% and bottom 35% of Stories and Reels. */
.safe { position: absolute; left: 0; right: 0; display: none; background: repeating-linear-gradient(45deg, rgb(255 60 60 / 0.28) 0 8px, rgb(255 60 60 / 0.12) 8px 16px); outline: 1px dashed rgb(255 80 80 / 0.9); }
.safe-top { top: 0; height: 14%; }
.safe-bottom { bottom: 0; height: 35%; }
.safe-toggle:checked ~ .tab-panel .safe { display: block; }

.export-sizes { list-style: none; margin: 0 0 12px; padding: 0; display: grid; }
.export-sizes li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.export-sizes li:last-child { border-bottom: 0; }
.export-sizes li > span:nth-child(2) { display: grid; flex: 1; min-width: 0; }
.export-sizes small { color: var(--muted); }
.size-shape { flex: none; width: 24px; border-radius: 4px; border: 1.5px solid var(--muted); }

/* Sign in */
.auth { max-width: 520px; display: grid; gap: 16px; }
.auth .lede { margin: 0; }
.auth-form { max-width: none; }

/* Account popover: workspace, team, billing */
a.credits { text-decoration: none; }
a.credits:hover { filter: brightness(0.95); }
.pop-ws { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 6px; }
.pop-links { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 2px; }
.pop-links a { display: block; padding: 6px 0; color: var(--text); text-decoration: none; font-weight: 600; }
.pop-links a:hover, .pop-links a[aria-current="page"] { color: var(--accent); }
.ws-switch { margin: 0 0 12px !important; padding-top: 10px; border-top: 1px solid var(--line); }
.pop-panel form + form { margin-top: 8px; }

/* Billing */
.billing-summary { display: grid; gap: 14px; margin-bottom: 28px; }
@media (min-width: 720px) { .billing-summary { grid-template-columns: 1fr 1fr; } }
.stat b { display: block; font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat p { color: var(--muted); margin-top: 4px; }
.stat .actions { margin-top: 14px; }
.interval { display: inline-flex; padding: 4px; border-radius: 99px; background: var(--alt); gap: 2px; margin-bottom: 16px; }
.interval label { padding: 6px 14px; border-radius: 99px; cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--muted); }
.interval label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.interval input { position: absolute; opacity: 0; pointer-events: none; }
.interval small { color: var(--accent); font-weight: 700; }
.plan-grid { display: grid; gap: 14px; }
@media (min-width: 860px) { .plan-grid { grid-template-columns: repeat(3, 1fr); } }
.plan-card { display: grid; gap: 12px; align-content: start; }
.plan-card.is-current { border: 2px solid var(--accent); }
.plan-card ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--muted); font-size: 0.94rem; }
.plan-price { color: var(--muted); }
.plan-price b { color: var(--text); font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; margin-right: 2px; }
.plan-price .yearly, .billing-plans.is-yearly .plan-price .monthly { display: none; }
.billing-plans.is-yearly .plan-price .yearly { display: inline; }
.plan-card form { margin-top: auto; }
.plan-card .btn { width: 100%; justify-content: center; }
.pack-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.pack-card { display: grid; gap: 8px; }
.pack-card b { font-size: 1.3rem; font-weight: 750; }
.billing-section { margin-top: 36px; }
.billing-section > h2 { margin-bottom: 6px; }
.billing-section > .muted { margin-bottom: 16px; }

/* Team */
.team-layout { display: grid; gap: 18px; }
@media (min-width: 960px) { .team-layout { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } }
.people { list-style: none; margin: 0; padding: 0; display: grid; }
.people li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.people li:first-child { border-top: 0; padding-top: 0; }
.people .who { flex: 1 1 200px; min-width: 0; display: grid; }
.people .who b { overflow-wrap: anywhere; font-weight: 600; }
.people .who small { color: var(--muted); }
.people form { margin: 0; display: flex; gap: 8px; align-items: center; }
.people select { height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.audit { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 0.92rem; }
.audit small { display: block; color: var(--muted); }
.seat-count { color: var(--muted); font-weight: 400; font-size: 0.92rem; }

/* Watermark note and upsell */
.upsell { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.pill-plan { background: var(--accent-soft); color: var(--accent); }
.choice-locked { color: inherit; text-decoration: none; border-style: dashed; }
.choice-locked:hover { border-color: var(--accent); }
