/* AdForge: one calm dark theme. Thin borders instead of shadows, one light accent, quiet type. */
:root {
  --bg: #0b0c0e;
  --surface: #121316;
  --surface-2: #17181c;
  --raised: #1d1e23;
  --line: #24262b;
  --line-strong: #32353c;
  --text: #ecedef;
  --muted: #8b9099;
  --faint: #5f646d;
  --accent: #ecedef;      /* primary buttons: light on dark */
  --accent-ink: #0b0c0e;
  --focus: #7ea6ff;
  --ok: #5cc38b;
  --warn: #e2b45c;
  --err: #f07c7c;
  --info: #8fb1ff;
  --radius: 12px;
  --radius-sm: 8px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14.5px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .35em; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: 24px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
p { margin: 0 0 .8em; }
a { color: var(--text); }
code { font: 12px/1 ui-monospace, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--line); padding: 2px 5px; border-radius: 5px; color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: rgba(126, 166, 255, .3); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; justify-content: center; }
.err { color: var(--err); }
.ok { color: var(--ok); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px; height: 56px; padding: 0 24px;
  background: rgba(11, 12, 14, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); position: relative; flex: none; }
.mark::after { content: ""; position: absolute; inset: 5px 5px 4px; background: var(--accent-ink); clip-path: polygon(0 100%, 50% 0, 100% 100%, 74% 100%, 50% 50%, 26% 100%); }
.word { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.project { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project:not(:empty)::before { content: "/"; margin-right: 10px; color: var(--faint); }
.tabs { display: none; gap: 4px; height: 100%; }
.tabs button {
  border: 0; background: none; padding: 0 10px; height: 100%; cursor: pointer; color: var(--muted);
  font-weight: 500; font-size: 13.5px; position: relative;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); }
.tabs button.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--text); }
#new-upload { display: none; margin-left: auto; }
.has-project .tabs { display: flex; }
.has-project #new-upload { display: inline-flex; }

main { max-width: 1180px; margin: 0 auto; padding: 32px 24px 96px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  padding: 0 14px; border-radius: var(--radius-sm); font-weight: 500; font-size: 13.5px; cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--raised); border-color: #3c4048; }
.btn:disabled { opacity: .5; cursor: progress; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #ffffff; border-color: #ffffff; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--err); background: transparent; border-color: transparent; }
.btn.danger:hover { background: rgba(240, 124, 124, .08); }
.btn.small { min-height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.link { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; font-size: inherit; }
.link:hover { color: var(--text); }
.icon-btn { border: 0; background: none; cursor: pointer; width: 32px; height: 32px; border-radius: 7px; color: var(--muted); flex: none; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- start page ---------- */
.hero { max-width: 640px; margin: 6vh auto 0; }
.hero h1 { font-size: clamp(30px, 4.6vw, 42px); letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 12px; }
.lead { font-size: 16px; color: var(--muted); margin: 0 0 28px; max-width: 54ch; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 40px 24px; border: 1px dashed var(--line-strong); border-radius: 16px; background: var(--surface);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--muted); background: var(--surface-2); }
.dz-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); margin-bottom: 10px; }
.dz-icon svg.i { width: 20px; height: 20px; }
.dropzone strong { font-size: 15px; font-weight: 600; }
.dropzone span { color: var(--muted); font-size: 13.5px; }
.hero .or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--faint); font-size: 12.5px; }
.hero .or::before, .hero .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hero .sample-row { display: flex; justify-content: center; }
.how { list-style: none; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; counter-reset: how; }
.how li { background: var(--surface); padding: 16px; counter-increment: how; }
.how b { display: block; margin-bottom: 4px; font-weight: 600; font-size: 13.5px; }
.how b::before { content: counter(how); display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; margin-right: 8px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 600; }
.how span { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.tips { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tips summary { cursor: pointer; padding: 12px 16px; font-size: 13px; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 8px; }
.tips summary::-webkit-details-marker { display: none; }
.tips summary::after { content: "+"; margin-left: auto; color: var(--faint); font-size: 16px; line-height: 1; }
.tips[open] summary::after { content: "–"; }
.tips summary:hover { color: var(--text); }
.tips ul { margin: 0; padding: 0 16px 14px 34px; color: var(--muted); font-size: 13px; }
.tips li + li { margin-top: 6px; }
.fine { color: var(--faint); font-size: 12.5px; display: flex; align-items: center; gap: 6px; margin-top: 20px; }

/* ---------- progress ---------- */
.progress-card { max-width: 460px; margin: 12vh auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.progress-card h2 { font-size: 16px; margin-bottom: 4px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--text); margin-bottom: 16px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { list-style: none; padding: 0; margin: 14px 0 0; }
.steps li { padding: 6px 0 6px 24px; position: relative; color: var(--muted); font-size: 13.5px; word-break: break-word; }
.steps li::before { content: ""; position: absolute; left: 3px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.steps li.done { color: var(--faint); }
.steps li.done::before { background: var(--ok); }
.steps li.active { color: var(--text); }
.steps li.active::before { background: var(--text); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .3; } }

/* ---------- page head ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 4px 0 0; font-size: 13.5px; }

/* ---------- filters ---------- */
.chips { display: inline-flex; gap: 2px; flex-wrap: wrap; margin-bottom: 20px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.chip { border: 0; background: none; border-radius: 7px; padding: 5px 11px; cursor: pointer; font-weight: 500; font-size: 12.5px; color: var(--muted); }
.chip span { color: var(--faint); margin-left: 5px; font-variant-numeric: tabular-nums; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--raised); color: var(--text); }
.chip.on span { color: var(--muted); }
.empty { color: var(--muted); padding: 56px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- ad grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .15s; }
.card:hover { border-color: var(--line-strong); }
.thumb { display: block; position: relative; width: 100%; border: 0; padding: 0; background: var(--surface-2); cursor: pointer; border-bottom: 1px solid var(--line); }
.thumb canvas { display: block; width: 100%; height: auto; }
.thumb.story { max-height: 360px; overflow: hidden; padding: 14px 0 0; }
.thumb.story canvas { width: 58%; margin: 0 auto; border-radius: 6px 6px 0 0; }
.play { position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; border-radius: 50%; background: rgba(11, 12, 14, .7); border: 1px solid rgba(255, 255, 255, .15); color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px); }
.play svg.i { width: 18px; height: 18px; fill: currentColor; margin-left: 2px; }
.card-body { padding: 12px 14px 14px; }
.card-body h3 { margin: 10px 0 4px; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-body p { margin: 0 0 12px; line-height: 1.5; }
.tag { font-size: 11.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.status { font-size: 11.5px; font-weight: 500; padding: 2px 8px 2px 7px; border-radius: 999px; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); color: var(--muted); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.draft { color: var(--muted); }
.status.approved { color: var(--info); border-color: rgba(143, 177, 255, .25); }
.status.scheduled { color: var(--warn); border-color: rgba(226, 180, 92, .25); }
.status.posted { color: var(--ok); border-color: rgba(92, 195, 139, .25); }
.meta-line { display: flex; align-items: center; gap: 6px; }
.meta-line svg.i { width: 13px; height: 13px; }

.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--raised); border: 1px solid var(--line-strong); border-radius: 10px; padding: 4px; z-index: 5; min-width: 190px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45); }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.menu button:hover { background: var(--surface-2); }

/* ---------- editor ---------- */
dialog#editor { border: 1px solid var(--line-strong); padding: 0; border-radius: 16px; width: min(1140px, calc(100vw - 32px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 24px 80px rgba(0, 0, 0, .6); }
dialog#editor::backdrop { background: rgba(0, 0, 0, .65); backdrop-filter: blur(2px); }
.editor { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.ed-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.ed-head > div { display: flex; align-items: center; gap: 10px; }
.ed-body { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; overflow: auto; }
.ed-preview { padding: 22px; background: var(--bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; align-self: start; min-height: 100%; }
.preview-frame { border-radius: 10px; overflow: hidden; margin: 0 auto; background: #000; border: 1px solid var(--line); }
.preview-frame canvas { display: block; width: 100%; height: auto; }
.preview-frame.square { width: 100%; }
.preview-frame.story { width: min(100%, 280px); }
.ed-form { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
fieldset { border: 0; padding: 0 0 20px; margin: 0; min-width: 0; border-bottom: 1px solid var(--line); }
legend { font-weight: 600; padding: 0; margin-bottom: 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 12px; }
input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea {
  width: 100%; min-height: 36px; padding: 8px 11px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--bg); color: var(--text); font-weight: 400; font-size: 13.5px; transition: border-color .12s;
}
input:not([type=checkbox]):not([type=radio]):not([type=color]):hover, select:hover, textarea:hover { border-color: #3c4048; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); }
input::placeholder, textarea::placeholder { color: var(--faint); }
select { appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b9099' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
input[type=checkbox] { accent-color: var(--text); width: 15px; height: 15px; margin: 0; }
textarea { resize: vertical; line-height: 1.5; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 10px; }
.shot-pick { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.shot-opt { flex: none; width: 116px; cursor: pointer; margin: 0; position: relative; }
.shot-opt input { position: absolute; opacity: 0; }
.shot-opt img { width: 116px; height: 72px; object-fit: cover; object-position: top; border-radius: 7px; border: 1px solid var(--line-strong); }
.shot-opt input:checked + img { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.shot-opt input:focus-visible + img { outline: 2px solid var(--focus); outline-offset: 2px; }
.shot-opt span { font-weight: 400; font-size: 11px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cap-tabs { display: inline-flex; gap: 2px; flex-wrap: wrap; margin-bottom: 10px; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; }
.cap-tab { border: 0; background: none; border-radius: 6px; padding: 4px 10px; font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--muted); }
.cap-tab:hover { color: var(--text); }
.cap-tab.on { background: var(--raised); color: var(--text); }
.cap-pane textarea { font-size: 13px; margin-bottom: 6px; }
.plat-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.plat { flex-direction: row; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 7px 11px; margin: 0; cursor: pointer; color: var(--text); font-size: 13px; }
.plat:has(input:checked) { border-color: var(--muted); background: var(--surface-2); }
.plat small { color: var(--faint); font-weight: 400; font-size: 11.5px; }
.plat.disabled { opacity: .45; cursor: not-allowed; }
.publish-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.publish-row p { margin: 0 0 4px; width: 100%; }
.publish-row input[type=datetime-local] { width: auto; color-scheme: dark; }
.ed-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- brand ---------- */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.panel > h2 { margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.brand-grid .panel { margin: 0; }
.panel.wide { grid-column: 1 / -1; }
.count { font-size: 11.5px; color: var(--muted); font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; font-variant-numeric: tabular-nums; }
.feat-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.feat-row textarea { grid-column: 1; font-size: 13px; }
.feat-row .icon-btn { grid-row: 1; grid-column: 2; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.color { flex-direction: row; align-items: center; gap: 8px; border: 1px solid var(--line-strong); padding: 5px 10px 5px 5px; border-radius: 9px; margin: 0; color: var(--text); }
.color input { width: 26px; height: 26px; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 6px; }
.color input::-webkit-color-swatch-wrapper { padding: 0; }
.color input::-webkit-color-swatch { border: 1px solid rgba(255, 255, 255, .12); border-radius: 6px; }
.swatches { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .12); cursor: pointer; }
.swatch:hover { transform: scale(1.08); }
.logo-row { display: flex; align-items: center; gap: 10px; }
.logo-box { width: 72px; height: 72px; border-radius: 12px; border: 1px solid var(--line); display: grid; place-items: center; background: repeating-conic-gradient(#1a1b1f 0 25%, #141518 0 50%) 0 0 / 12px 12px; }
.logo-box img { max-width: 58px; max-height: 58px; }
.logo-row .btn, .panel > label.btn { flex-direction: row; margin: 0; color: var(--text); }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
.shots figure { margin: 0; }
.shots img { width: 100%; aspect-ratio: 16/10; object-fit: cover; object-position: top; border-radius: 9px; border: 1px solid var(--line); }
.shots figcaption { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--faint); margin-top: 6px; }

/* ---------- schedule ---------- */
.queue { list-style: none; padding: 0; margin: 0; }
.queue li { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.queue li:first-child { border-top: 0; padding-top: 0; }
.queue time { font-weight: 500; font-variant-numeric: tabular-nums; min-width: 170px; color: var(--muted); font-size: 13px; }
.q-title { flex: 1; min-width: 180px; font-weight: 500; }
.log { width: 100%; border-collapse: collapse; font-size: 13px; }
.log th, .log td { text-align: left; padding: 10px 12px 10px 0; border-top: 1px solid var(--line); vertical-align: top; }
.log th { color: var(--faint); font-weight: 500; font-size: 12px; border-top: 0; padding-top: 0; }
.panel .muted:last-child { margin-bottom: 0; }

/* ---------- accounts ---------- */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.acct { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.acct h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 14.5px; }
.acct p { margin: 0; }
.acct .btn { align-self: flex-start; margin-top: auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.notice svg.i { margin-top: 2px; color: var(--faint); }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--raised); color: var(--text); border: 1px solid var(--line-strong); padding: 10px 14px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 12px 32px rgba(0, 0, 0, .5); transition: opacity .35s, transform .35s; }
.toast::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.toast.success::before { background: var(--ok); }
.toast.error::before { background: var(--err); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- smaller screens ---------- */
@media (max-width: 860px) {
  .ed-body { grid-template-columns: 1fr; }
  .ed-preview { position: static; border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; }
  .how { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .topbar { height: auto; padding: 10px 16px 0; flex-wrap: wrap; gap: 4px 12px; }
  .topbar .brand { padding-bottom: 8px; }
  .has-project .tabs { order: 3; width: calc(100% + 32px); margin: 0 -16px; padding: 0 6px; height: 42px; overflow-x: auto; border-top: 1px solid var(--line); }
  #new-upload { margin: 0; }
  main { padding: 22px 16px 72px; }
  h1 { font-size: 21px; }
  .hero { margin-top: 3vh; }
  .how { grid-template-columns: 1fr; }
  .brand-grid { grid-template-columns: 1fr; }
  .queue time { min-width: 0; }
  .chips { display: flex; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .chip { flex: none; }
  dialog#editor { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; border: 0; }
  .editor { max-height: 100dvh; height: 100%; }
  .ed-form { padding: 18px 16px 24px; }
}

/* ---------- home page ---------- */
.home { max-width: 980px; margin: 0 auto; }
.home-hero { max-width: 680px; padding: 7vh 0 40px; }
.eyebrow { display: inline-block; font-size: 12.5px; color: var(--muted); border: 1px solid var(--line); background: var(--surface); padding: 3px 10px; border-radius: 999px; margin-bottom: 18px; }
.home-hero h1 { font-size: clamp(32px, 5.2vw, 52px); letter-spacing: -0.035em; line-height: 1.05; margin-bottom: 16px; }
.home-hero .lead { font-size: 16.5px; }
.home-hero .row { gap: 10px; }
.home-hero .btn { min-height: 42px; padding: 0 18px; font-size: 14px; }
.formats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 64px; }
.fmt { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.fmt b { font-weight: 600; font-size: 13.5px; margin-top: 12px; }
.fmt > span:last-child { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.fmt-art { height: 92px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); position: relative; display: grid; place-items: center; }
.fmt-art::before { content: ""; background: linear-gradient(160deg, #2a2d34, #1b1d22); border: 1px solid var(--line-strong); border-radius: 5px; }
.fmt-art.sq::before { width: 62px; height: 62px; }
.fmt-art.tall::before { width: 42px; height: 74px; }
.fmt-art.vid svg.i { position: absolute; width: 14px; height: 14px; fill: var(--text); stroke: none; }
.fmt-art.cap::before { display: none; }
.fmt-art.cap { place-content: center; gap: 7px; }
.fmt-art.cap i { display: block; height: 6px; border-radius: 3px; background: var(--line-strong); width: 84px; }
.fmt-art.cap i:nth-child(2) { width: 70px; }
.fmt-art.cap i:nth-child(3) { width: 48px; }
.home-split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; margin-bottom: 64px; scroll-margin-top: 80px; }
.sec-h { font-size: 13px; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; margin-bottom: 14px; }
.home .how { grid-template-columns: 1fr; margin: 0; }
.home .dropzone { padding: 48px 24px; }
.faq { max-width: 680px; margin-bottom: 56px; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 14px 0; font-weight: 500; display: flex; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; margin-left: auto; color: var(--faint); font-size: 18px; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq p { color: var(--muted); margin: -4px 0 16px; max-width: 60ch; }
.home-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 22px 0 0; border-top: 1px solid var(--line); }
.topbar .brand { cursor: pointer; }
@media (max-width: 860px) {
  .formats { grid-template-columns: 1fr 1fr; }
  .home-split { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 480px) {
  .home-hero { padding-top: 4vh; }
  .home-hero .row .btn { width: 100%; }
  .formats { gap: 8px; margin-bottom: 44px; }
  .fmt { padding: 12px; }
  .fmt-art { height: 72px; }
}

/* ---------- accounts and plans ---------- */
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
#new-upload { margin-left: 0; }
.avatar-btn { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; }
.avatar-btn:hover { border-color: var(--muted); }
.acct-menu { min-width: 230px; }
.acct-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acct-head b { font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.pro-tag { display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; padding: 1px 6px; border-radius: 5px; background: var(--text); color: var(--bg); vertical-align: 1px; }
.pro-tag.big { font-size: 12px; padding: 3px 9px; margin-bottom: 14px; align-self: flex-start; }
dialog.modal { border: 1px solid var(--line-strong); padding: 0; border-radius: 16px; width: min(400px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 24px 80px rgba(0, 0, 0, .6); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .65); backdrop-filter: blur(2px); }
.auth { padding: 28px; position: relative; display: flex; flex-direction: column; }
.auth h2 { font-size: 19px; margin-bottom: 4px; }
.auth > p.muted { margin-bottom: 18px; }
.auth label { margin-bottom: 14px; }
.modal-x { position: absolute; top: 12px; right: 12px; }
.mark.big { width: 30px; height: 30px; border-radius: 8px; margin-bottom: 18px; }
.mark.big::after { inset: 7px 7px 6px; }
.btn.wide { width: 100%; min-height: 40px; }
.auth .link { align-self: center; margin-top: 12px; }
.auth .switch { text-align: center; margin: 16px 0 0; }
.auth .switch .link { margin: 0; }
.practice-note { font-size: 12px; color: var(--warn); border: 1px solid rgba(226, 180, 92, .25); background: rgba(226, 180, 92, .06); border-radius: 8px; padding: 8px 10px; margin: -6px 0 16px; }
#au-err:empty, #up-err:empty { display: none; }
#au-err, #up-err { margin: -4px 0 12px; }
.up-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; font-size: 13.5px; }
.up-list li, .plan li { display: flex; align-items: center; gap: 8px; }
.up-list svg.i, .plan svg.i { width: 14px; height: 14px; color: var(--ok); }
.cycle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.cycle button { text-align: left; border: 1px solid var(--line-strong); background: var(--bg); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.cycle button b { font-weight: 600; font-size: 13.5px; }
.cycle button span { color: var(--muted); font-size: 12px; }
.cycle button[aria-checked="true"] { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.plans { display: grid; gap: 12px; }
.plan { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.plan.pro { border-color: var(--line-strong); background: var(--surface-2); }
.plan-top { display: flex; justify-content: space-between; align-items: baseline; }
.plan-top b { font-weight: 600; font-size: 15px; }
.price { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.price small { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-left: 2px; }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; font-size: 13px; color: var(--muted); }
.plan .btn { align-self: flex-start; }
.plan-alt { margin: -4px 0 0; font-size: 12px; color: var(--faint); }
.plan-note { font-size: 12px; color: var(--muted); }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-bottom: 40px; }
.proj { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 6px 6px 6px 0; transition: border-color .15s; }
.proj:hover { border-color: var(--line-strong); }
.proj-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: none; text-align: left; cursor: pointer; padding: 8px 4px 8px 12px; }
.proj-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; flex: none; }
.proj-txt { display: flex; flex-direction: column; min-width: 0; }
.proj-txt b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-split.dash { margin-top: 0; }
.limit-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line-strong); background: var(--surface-2); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.limit-card > svg.i { margin-top: 2px; color: var(--muted); }
.limit-card b { font-weight: 600; font-size: 13.5px; }
.limit-card p { margin: 2px 0 10px; }
@media (max-width: 640px) {
  .top-right { gap: 6px; padding-bottom: 8px; }
  .top-right .btn.small { min-height: 28px; padding: 0 9px; }
  .project { display: none; }
}

/* ---------- signed-in homepage ---------- */
.faint { color: var(--faint); }
.dash-home { max-width: 1040px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 8px 0 22px; }
.dash-head h1 { font-size: 28px; letter-spacing: -0.025em; margin-bottom: 6px; }
.dash-head p { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.plan-chip { font-size: 11.5px; font-weight: 500; color: var(--muted); border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 1px 9px; }
.plan-chip.pro { color: var(--bg); background: var(--text); border-color: var(--text); }
.new-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; margin-bottom: 40px; }
.new-card h2 { font-size: 15px; margin-bottom: 16px; }
.new-form { display: grid; gap: 14px; }
.new-form label { margin: 0; }
.new-form label > span:first-child { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.input-icon { position: relative; display: block; }
.input-icon svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.input-icon input { padding-left: 36px !important; min-height: 42px !important; font-size: 14px !important; }
.or-line { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.dropzone.compact { flex-direction: row; text-align: left; gap: 14px; padding: 14px 16px; border-radius: 12px; background: var(--bg); }
.dropzone.compact .dz-icon { margin: 0; width: 38px; height: 38px; }
.dropzone.compact .dz-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dropzone.compact strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone.compact .dz-text span { font-size: 12px; }
.dropzone.has-file { border-style: solid; border-color: var(--line-strong); }
#np-err:empty { display: none; }
.new-form .row.between { margin-top: 2px; }
.new-form .btn.primary { min-height: 40px; padding: 0 18px; }
.dash-cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
.dash-cols .proj-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: 0; }
.proj { flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; position: relative; }
.proj-open { flex-direction: column; align-items: stretch; padding: 0; gap: 0; }
.proj-thumb { display: grid; place-items: center; aspect-ratio: 16 / 10; background: var(--bg); border-bottom: 1px solid var(--line); overflow: hidden; color: var(--faint); font-size: 26px; font-weight: 600; }
.proj-thumb img { width: 100%; height: 100%; object-fit: cover; }
.proj-txt { padding: 10px 12px 12px; }
.proj > .icon-btn { position: absolute; right: 6px; bottom: 8px; }
.dash-side .tips-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 12px; font-size: 13px; color: var(--muted); }
.dash-side .tips-list li { display: flex; gap: 10px; align-items: flex-start; }
.dash-side .tips-list svg.i { margin-top: 2px; color: var(--faint); }
.dash-side .tips-list b { color: var(--text); font-weight: 500; }
.dash-side .tips { margin-top: 0; }
@media (max-width: 860px) { .dash-cols { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .new-card { padding: 16px; } .dash-head h1 { font-size: 24px; } .new-form .row.between { flex-direction: column-reverse; align-items: stretch; gap: 12px; } .new-form .btn.primary { width: 100%; } }

/* ---------- assistant ---------- */
.chat { max-width: 760px; display: flex; flex-direction: column; gap: 12px; }
.chat-log { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; min-height: 340px; max-height: 58vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 360px; padding: 30px 0; }
.chat-empty svg.i { width: 22px; height: 22px; color: var(--muted); margin-bottom: 6px; }
.chat-empty b { font-weight: 600; }
.msg { display: flex; flex-direction: column; max-width: 82%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.assistant { align-self: flex-start; }
.bubble { padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.msg.user .bubble { background: var(--text); color: var(--bg); border-bottom-right-radius: 5px; }
.msg.assistant .bubble { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg-meta { font-size: 11.5px; color: var(--ok); margin-top: 4px; }
.typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chips.sugg { display: flex; flex-wrap: wrap; background: none; border: 0; padding: 0; margin: 0; gap: 6px; }
.chips.sugg .chip { border: 1px solid var(--line); background: var(--surface); }
.chips.sugg .chip:hover { border-color: var(--line-strong); }
.chat-form { display: flex; gap: 8px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; padding: 6px; }
.chat-form:focus-within { border-color: var(--muted); }
.chat-form textarea { border: 0 !important; background: none !important; resize: none; min-height: 38px !important; max-height: 160px; padding: 9px 10px !important; }
.chat-form textarea:focus { outline: none; }
.chat-form .btn { min-height: 38px; width: 38px; padding: 0; border-radius: 10px; }
.chat-note { margin: 0; }
@media (max-width: 640px) { .chips.sugg { flex-wrap: nowrap; overflow-x: auto; } .chips.sugg .chip { flex: none; } .msg { max-width: 92%; } .chat-log { max-height: 52vh; } }
@media (max-width: 480px) { .dash-cols .proj-grid { grid-template-columns: 1fr 1fr; gap: 8px; } .proj-txt { padding: 8px 10px 10px; } .proj > .icon-btn { right: 2px; bottom: 4px; } }

/* ---------- profile kit ---------- */
.kit-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.kit-pic { display: flex; flex-direction: column; gap: 12px; }
.kit-pic h2, .kit-text h2 { margin-bottom: 4px; }
.pic-wrap { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.pic-wrap canvas { display: block; width: 100%; height: auto; }
.pic-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(11, 12, 14, .55); pointer-events: none; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; }
.seg button { border: 0; background: none; border-radius: 6px; padding: 6px 8px; font-size: 12.5px; font-weight: 500; color: var(--muted); cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--raised); color: var(--text); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.kit-pic .btn { align-self: flex-start; }
.kit-pic p { margin: 0; }
.copy-row { display: flex; gap: 6px; align-items: flex-start; }
.copy-row input, .copy-row textarea { flex: 1; min-width: 0; }
.copy-row .icon-btn { margin-top: 2px; }
.lbl-plain { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.handles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.handle { border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); border-radius: 999px; padding: 4px 11px; font-size: 13px; cursor: pointer; }
.handle:hover { border-color: var(--muted); }
.count-chip { font-weight: 400; color: var(--faint); font-variant-numeric: tabular-nums; margin-left: 4px; }
.count-chip.over { color: var(--err); }
.kit-text label { flex-direction: column; }
.kit-ai { display: flex; gap: 8px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.kit-ai input { flex: 1; min-width: 0; }
@media (max-width: 860px) { .kit-grid { grid-template-columns: 1fr; } .kit-pic { max-width: 420px; } }
@media (max-width: 480px) { .kit-ai { flex-direction: column; } }
.field-kit select { width: 100%; }
#kit-apply { width: auto; min-width: 180px; }
.thumb.pin { max-height: 360px; overflow: hidden; padding: 14px 0 0; } .thumb.pin canvas { width: 62%; margin: 0 auto; border-radius: 6px 6px 0 0; } .preview-frame.pin { width: min(100%, 300px); } .preview-frame.youtube, .preview-frame.banner { width: 100%; }
