/* ————— SocialMedia Kit — paper, ink, one amber tick ————— */

/* Bundled Geist (SIL OFL, see /fonts/geist/OFL.txt) — no third-party font requests. */
@font-face { font-family: "Geist"; src: url("/fonts/geist/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/geist/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  /* Hoverfly-derived neutrals */
  --paper: #ebebeb;
  --surface: #fdfdfd;
  --surface-2: #dedede;
  --hover: #f4f4f4;
  --line: #d1d1d1;
  --line-strong: #b1b1b1;
  --ink: #0d0d0d;
  --ink-2: #585858;
  --ink-3: #868686;
  /* one accent */
  --amber: #f3b01d;
  --amber-strong: #af7100;
  --amber-tint: #faeccb;
  /* states */
  --danger: #d73337;
  --danger-tint: #f6dede;
  --ok: #2c7a4b;
  --ok-tint: #dcecdf;
  --info: #3b62a8;
  --info-tint: #dde5f3;

  /* legacy aliases still referenced from app.js inline styles */
  --muted: var(--ink-2);
  --bad: var(--danger);
  --warn: var(--amber-strong);
  --amber-ink: var(--amber-strong);

  --radius: 10px;
  --radius-sm: 6px;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--sans); color: var(--ink); background: var(--paper);
  font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01";
}
.hidden { display: none !important; }
a { color: inherit; }
button { font: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg.chart { stroke: none; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.015em; }

::selection { background: rgba(243, 176, 29, .35); }
:focus-visible { outline: 2px solid var(--amber-strong); outline-offset: 2px; border-radius: 4px; }

/* The signature: a hairline with a short amber segment, as on hoverfly's section breaks. */
.tick-rule {
  height: 1px;
  background: linear-gradient(to right, var(--amber) 0 56px, var(--line) 56px 100%);
}

/* ————— Logo ————— */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; letter-spacing: -0.02em; color: var(--ink); }
.logo-mark { width: 26px; height: 26px; flex: none; stroke: none; }
.logo-mark .lm-fill { fill: var(--amber); }
.logo-mark .lm-line { fill: none; stroke: var(--ink); stroke-width: 7; }

/* ————— Auth ————— */
.auth { min-height: 100vh; display: flex; flex-direction: column; }
.auth-top { padding: 18px 40px; border-bottom: 1px solid var(--line); }
.auth-main {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, 420px);
  gap: 64px; align-items: center; padding: 56px 40px; max-width: 1240px; width: 100%; margin: 0 auto;
}
.auth-headline {
  font-size: clamp(40px, 5.6vw, 72px); line-height: 0.98; letter-spacing: -0.035em; font-weight: 600;
  max-width: 11ch;
}
.auth-claim { margin-top: 24px; color: var(--ink-2); font-size: 17px; line-height: 1.6; max-width: 46ch; }
.auth-cards { margin-top: 48px; display: flex; gap: 16px; }
.authcard {
  width: 156px; aspect-ratio: 4 / 5; border-radius: 8px; padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  font-weight: 600; letter-spacing: -0.02em;
  border: 1px solid var(--line);
}
.authcard i { font-style: normal; font-family: var(--mono); font-size: 10px; font-weight: 400; letter-spacing: 0; opacity: .6; align-self: flex-end; }
.authcard em { font-style: normal; font-size: 17px; line-height: 1.12; }
.authcard b { font-size: 46px; line-height: 1; letter-spacing: -0.04em; margin-top: auto; }
.authcard small { margin-top: auto; font-size: 10px; font-weight: 500; opacity: .6; letter-spacing: 0; }
.authcard .pill { margin-top: auto; align-self: flex-start; font-size: 10px; letter-spacing: 0; padding: 3px 8px; border-radius: 999px; background: var(--ink); color: var(--paper); }
.authcard.c1 { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.authcard.c1 em { margin-top: 18px; }
.authcard.c2 { background: var(--amber); color: var(--ink); border-color: var(--amber); transform: translateY(18px); }
.authcard.c2 em { font-size: 13px; font-weight: 500; letter-spacing: -0.01em; }
.authcard.c3 { background: var(--surface); }
.authcard.c3 em { margin-top: auto; }
.auth-panel { display: flex; }
.auth-box {
  width: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 32px;
}
.auth-box h2 { font-size: 24px; letter-spacing: -0.025em; }
.auth-box form { margin-top: 24px; display: flex; flex-direction: column; gap: 16px; }
.auth-switch { margin-top: 20px; color: var(--ink-2); font-size: 13.5px; }
.auth-switch a { color: var(--ink); font-weight: 500; text-underline-offset: 3px; margin-left: 4px; }

/* ————— Shell ————— */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.rail {
  background: var(--paper); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px; padding: 0 12px 12px;
  position: sticky; top: 0; height: 100vh;
}
.rail-brand { padding: 18px 8px 22px; }
.rail > a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm); text-decoration: none;
  color: var(--ink-2); font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
}
.rail > a svg { width: 18px; height: 18px; flex: none; }
.rail > a:hover { color: var(--ink); background: var(--hover); }
.rail > a.active { color: var(--ink); background: var(--surface); border-color: var(--line); }
.rail > a.active svg { color: var(--amber-strong); }
.rail-spring { flex: 1; }
.rail-user {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  padding: 12px 6px 0 8px; border-top: 1px solid var(--line);
}
.avatar {
  width: 30px; height: 30px; border-radius: 999px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--paper); font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
}
.rail-user-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.rail-user-text b { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-user-text small { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-logout { border: 1px solid transparent; background: transparent; border-radius: var(--radius-sm); padding: 5px; color: var(--ink-3); display: inline-flex; }
.rail-logout svg { width: 16px; height: 16px; }
.rail-logout:hover { color: var(--ink); border-color: var(--line); background: var(--surface); }

.view { padding: 32px 40px 96px; max-width: 1240px; width: 100%; margin: 0 auto; }

/* ————— Page header ————— */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  margin-bottom: 28px; padding-bottom: 20px; position: relative;
}
.page-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(to right, var(--amber) 0 56px, var(--line) 56px 100%);
}
.page-head h1 { font-size: 30px; line-height: 1.1; letter-spacing: -0.03em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-2); margin-top: 6px; font-size: 14px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ————— Buttons, inputs ————— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:hover { background: #2a2a2a; }
.btn.accent { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.btn.accent:hover { background: #e6a512; border-color: #e6a512; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-tint); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.block { width: 100%; height: 40px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); background: var(--hover); }
.btn.ghost.danger:hover { color: var(--danger); background: var(--danger-tint); }

label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13px; color: var(--ink); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="datetime-local"], input[type="time"], select, textarea {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--surface);
  font-weight: 400; font-size: 14px; min-height: 36px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--amber-strong);
  box-shadow: 0 0 0 3px rgba(243, 176, 29, .22);
}
input[type="checkbox"] { accent-color: var(--ink); width: 15px; height: 15px; }
input[type="range"] { accent-color: var(--ink); }
input[type="color"] { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); height: 36px; width: 48px; padding: 3px; cursor: pointer; }
textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
textarea.code { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre; }
.field-hint { color: var(--ink-2); font-weight: 400; font-size: 12.5px; line-height: 1.5; }
.form-error {
  background: var(--danger-tint); color: #8f1d20; border: 1px solid #ebbcbd;
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px;
}

/* ————— Cards & layout helpers ————— */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card .card-head {
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card .card-head h2 { font-size: 15px; letter-spacing: -0.01em; }
.card .card-body { padding: 20px; }
.grid { display: grid; gap: 20px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.muted { color: var(--ink-2); }
.mono { font-family: var(--mono); font-size: 12px; }

/* ————— Pills ————— */
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 1.5;
  white-space: nowrap; letter-spacing: 0;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.draft { background: var(--surface-2); color: var(--ink-2); }
.chip.scheduled { background: var(--amber-tint); color: #7a4f00; }
.chip.publishing { background: var(--info-tint); color: var(--info); }
.chip.published { background: var(--ok-tint); color: var(--ok); }
.chip.failed { background: var(--danger-tint); color: #a3242a; }
.chip.sandbox { background: #e6e1f3; color: #5a4697; }

/* ————— Stats (hoverfly feature-column style) ————— */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-bottom: 32px; }
.stat { border-top: 1px solid var(--line); padding-top: 14px; position: relative; }
.stat .n {
  font-size: 36px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat .l { color: var(--ink-2); font-size: 13px; font-weight: 400; margin-top: 4px; }
/* ————— Post list rows ————— */
.post-row { display: flex; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--line); align-items: center; cursor: pointer; transition: background .1s ease; }
.post-row:last-child { border-bottom: none; }
.post-row:hover { background: var(--hover); }
.post-thumb { width: 40px; height: 50px; border-radius: 4px; overflow: hidden; flex: none; background: var(--surface-2); border: 1px solid var(--line); position: relative; }
.post-thumb .count { position: absolute; right: 2px; bottom: 2px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 9px; border-radius: 3px; padding: 0 4px; }
.post-row .meta { flex: 1; min-width: 0; }
.post-row .cap { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-row .when { color: var(--ink-3); font-size: 12.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-row .chips { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }

/* ————— Mini slide preview (scaled iframe) ————— */
.mini-preview { position: relative; overflow: hidden; background: var(--surface-2); }
.mini-preview iframe { position: absolute; top: 0; left: 0; transform-origin: 0 0; border: 0; pointer-events: none; }
.mini-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ————— Planner ————— */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.cal-head h2 { font-size: 20px; letter-spacing: -0.025em; min-width: 200px; margin-left: 4px; }
.calendar {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--line); gap: 1px;
}
.cal-dow { background: var(--paper); color: var(--ink-3); font-size: 12px; font-weight: 500; padding: 8px 10px; }
.cal-cell { background: var(--surface); min-height: 118px; padding: 8px; transition: background .1s ease; }
.cal-cell.out { background: #f6f6f6; color: var(--ink-3); }
.cal-cell .d {
  font-family: var(--mono); font-size: 12px; width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 999px;
}
.cal-cell.today .d { background: var(--ink); color: var(--paper); }
.cal-post {
  display: flex; gap: 6px; align-items: center; margin-top: 5px; padding: 3px 7px 3px 6px;
  border-radius: 4px; font-size: 12px; font-weight: 500; cursor: pointer; overflow: hidden; white-space: nowrap;
  background: var(--hover); border-left: 2px solid var(--line-strong);
}
.cal-post .t { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); flex: none; }
.cal-post span:last-child { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cal-post.scheduled { background: var(--amber-tint); border-left-color: var(--amber); }
.cal-post.published { background: var(--ok-tint); border-left-color: var(--ok); }
.cal-post.failed { background: var(--danger-tint); border-left-color: var(--danger); }
.cal-post.draft { background: var(--hover); border-left-color: var(--line-strong); }
.cal-post:hover { filter: brightness(.97); }
.cal-post[draggable="true"] { cursor: grab; }
.cal-cell.drop { background: var(--amber-tint); outline: 1px dashed var(--amber-strong); outline-offset: -4px; }

/* ————— Composer ————— */
.composer { display: grid; grid-template-columns: minmax(0, 1fr) 312px; gap: 24px; align-items: start; }
.slide-list { display: flex; flex-direction: column; gap: 16px; container-type: inline-size; }
@container (max-width: 560px) {
  .slide-list .slide-card { grid-template-columns: minmax(0, 1fr); }
  .slide-list .slide-card .preview-pane { border-right: none; border-bottom: 1px solid var(--line); }
}
.slide-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; grid-template-columns: 220px 1fr; overflow: hidden; }
.slide-card .preview-pane { background: var(--surface-2); padding: 14px; display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--line); }
.slide-card .preview-pane .mini-preview { border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.slide-card .fields { padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.slide-card .fields .slide-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.slide-card .fields .slide-head .t { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.token-chip {
  font-family: var(--mono); font-size: 11.5px; font-weight: 400; color: var(--ink-2);
  background: var(--paper); border: 1px solid var(--line); padding: 1px 6px; border-radius: 4px; align-self: flex-start;
}
.img-drop { border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 18px; text-align: center; color: var(--ink-2); }
.img-drop img { max-width: 100%; max-height: 220px; border-radius: 4px; }
.img-field { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; background: var(--paper); }
.img-thumb { width: 60px; height: 60px; flex: none; border-radius: 4px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--ink-3); }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.side-panel { position: sticky; top: 28px; display: flex; flex-direction: column; gap: 16px; }
.ai-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; position: relative; overflow: hidden; }
.ai-panel::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--amber); }
.ai-panel h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; letter-spacing: -0.01em; }
.ai-panel .btn.accent { margin-top: 2px; }
.ai-note { font-size: 12px; color: var(--ink-3); margin-top: 12px; line-height: 1.5; }

/* ————— Layouts (templates) ————— */
.tabbar {
  display: inline-flex; gap: 2px; background: var(--surface); border: 1px solid var(--line-strong);
  padding: 3px; border-radius: var(--radius-sm); width: max-content;
}
.tabbar button { border: none; background: transparent; height: 28px; padding: 0 14px; border-radius: 4px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.tabbar button:hover { color: var(--ink); }
.tabbar button.active { background: var(--ink); color: var(--paper); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.tpl-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: border-color .12s ease, transform .12s ease;
}
.tpl-card:hover { border-color: var(--ink); transform: translateY(-1px); }
.tpl-card .mini-preview { width: 100%; aspect-ratio: 4 / 5; border-bottom: 1px solid var(--line); }
.tpl-card .info { padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tpl-card .info b { font-size: 13px; font-weight: 500; }
.pagetype {
  display: inline-block; font-size: 11.5px; font-weight: 500; color: #7a4f00; background: var(--amber-tint);
  padding: 1px 8px; border-radius: 999px; white-space: nowrap;
}
.pagetype::first-letter { text-transform: uppercase; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); gap: 24px; align-items: start; }
.editor .preview-side { position: sticky; top: 28px; }

.group-item { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; }
.group-item .pos { font-family: var(--mono); font-size: 12px; color: var(--ink-3); width: 20px; }
.group-item .grow { flex: 1; }

/* ————— Inbox ————— */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
.media-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; }
.media-item:last-child { border-bottom: none; }
.media-item:hover { background: var(--hover); }
.media-item.active { background: var(--amber-tint); }
.media-item img { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; background: var(--surface-2); flex: none; }
.media-item .cap { font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.comment { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: none; }
.comment .who { font-weight: 500; font-size: 13.5px; }
.comment .txt { margin-top: 3px; line-height: 1.55; color: var(--ink); }
.comment .sub { margin-left: 22px; margin-top: 10px; padding: 0 0 0 12px; border-left: 2px solid var(--line); border-bottom: none; }
.reply-box { display: flex; gap: 6px; margin-top: 10px; align-items: center; }
.reply-box input { flex: 1; }

/* ————— Library ————— */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.lib-item { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.lib-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--surface-2); }
.lib-item .m { padding: 6px 6px 6px 10px; display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }

/* ————— Canvas editor ————— */
.cv-root {
  display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 16px; align-items: start;
  grid-template-areas: "tools stage props";
}
.cv-root > :nth-child(1) { grid-area: tools; }
.cv-root > :nth-child(2) { grid-area: stage; }
.cv-root > :nth-child(3) { grid-area: props; }
.cv-stage {
  background-color: var(--surface-2);
  background-image: radial-gradient(rgba(13, 13, 13, .14) 1px, transparent 1px);
  background-size: 18px 18px;
  border: 1px solid var(--line); border-radius: var(--radius); min-height: 680px;
  display: flex; align-items: flex-start; justify-content: center; padding: 24px;
  outline: none; overflow: auto;
}
.cv-wrap { position: relative; flex: none; box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 12px 32px rgba(0,0,0,.14); }
.cv-artboard { position: absolute; top: 0; left: 0; transform-origin: 0 0; overflow: hidden; }
.cv-el { cursor: grab; user-select: none; }
.cv-el:active { cursor: grabbing; }
.cv-el[contenteditable] { cursor: text; user-select: text; outline: 2px dashed var(--amber); }
.cv-overlay { position: absolute; inset: 0; pointer-events: none; }
.cv-selbox { position: absolute; border: 1.5px solid var(--amber); pointer-events: none; }
.cv-handle {
  position: absolute; width: 10px; height: 10px; background: var(--surface); border: 1.5px solid var(--amber-strong);
  border-radius: 2px; pointer-events: auto;
}
.cv-handle.nw { left: -6px; top: -6px; cursor: nwse-resize; }
.cv-handle.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.cv-handle.sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.cv-handle.se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.cv-guide-v { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid #e8368f; pointer-events: none; }
.cv-guide-h { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid #e8368f; pointer-events: none; }
.cv-layer {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 1px solid transparent; background: transparent; padding: 6px 8px; border-radius: 4px;
  font-size: 13px; color: var(--ink);
}
.cv-layer:hover { background: var(--hover); }
.cv-layer.active { background: var(--amber-tint); border-color: #efd28f; }
.cv-layer-type { width: 18px; text-align: center; color: var(--ink-3); font-family: var(--mono); font-size: 12px; flex: none; }
.cv-field { font-size: 12px; gap: 4px; }
.cv-field input[type="color"] { width: 44px; height: 32px; }
@media (max-width: 1440px) {
  .cv-root { grid-template-columns: minmax(0, 1fr) 280px; grid-template-areas: "stage props" "tools props"; }
}
@media (max-width: 900px) {
  .cv-root { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "props" "tools"; }
  .cv-stage { min-height: 480px; }
}

/* ————— Tables ————— */
table.list { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.list th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--ink-3); padding: 10px 20px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 12px 20px; border-bottom: 1px solid var(--line); }
table.list tr:last-child td { border-bottom: none; }
table.list tbody tr:hover td { background: var(--hover); }

/* ————— Modal ————— */
.modal-back { position: fixed; inset: 0; background: rgba(13, 13, 13, .35); display: flex; align-items: center; justify-content: center; padding: 30px; z-index: 50; animation: fade .15s ease; }
.modal {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .18);
}
.modal h2 { font-size: 20px; letter-spacing: -0.025em; margin-bottom: 16px; }

/* ————— Toast ————— */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--paper); padding: 10px 16px 10px 14px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, .22); z-index: 100;
  animation: rise .18s ease;
}
.toast::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); flex: none; }
.toast.error::before { background: #ff6b6e; }

/* ————— Empty states ————— */
.empty { padding: 44px 20px; text-align: center; color: var(--ink-2); }
.empty b { display: block; font-size: 16px; font-weight: 600; letter-spacing: -0.015em; color: var(--ink); margin-bottom: 6px; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 6px); } }

@media (max-width: 1000px) {
  .composer, .editor, .inbox { grid-template-columns: 1fr; }
  .side-panel, .editor .preview-side { position: static; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-main { grid-template-columns: 1fr; gap: 36px; padding: 32px 20px; }
  .auth-cards { display: none; }
  .auth-top { padding: 16px 20px; }
  .shell { grid-template-columns: 60px minmax(0, 1fr); }
  .rail { padding: 0 8px 10px; }
  .rail-brand { padding: 16px 0 18px; display: flex; justify-content: center; }
  .rail .logo-text, .rail > a span, .rail-user-text, .rail-logout { display: none; }
  .rail > a { justify-content: center; padding: 9px 0; }
  .rail-user { justify-content: center; padding: 10px 0 0; }
  .view { padding: 20px 16px 60px; }
  .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .slide-card { grid-template-columns: 1fr; }
  .slide-card .preview-pane { border-right: none; border-bottom: 1px solid var(--line); }
}

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

/* ————— Brand setup wizard (#/welcome) ————— */
body.onboarding .shell { grid-template-columns: minmax(0, 1fr); }
body.onboarding .rail { display: none; }
.wz { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: start; max-width: 1080px; margin: 0 auto; }
.wz-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.wz-title { font-size: 34px; letter-spacing: -0.035em; line-height: 1.1; }
.wz-top .muted { margin-top: 6px; }
.wz-steps { list-style: none; display: flex; gap: 6px; margin: 24px 0 16px; flex-wrap: wrap; }
.wz-steps li { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-3); padding: 4px 10px 4px 4px; border-radius: 999px; }
.wz-steps .num { width: 22px; height: 22px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11.5px; border: 1px solid var(--line-strong); background: var(--surface); }
.wz-steps li.current { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.wz-steps li.current .num { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.wz-steps li.done { color: var(--ink-2); }
.wz-steps li.done .num { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.wz-h { font-size: 19px; letter-spacing: -0.02em; }
.wz-nav { display: flex; justify-content: space-between; margin-top: 16px; }
.field-label { font-weight: 500; font-size: 13px; margin-bottom: 8px; }

.wz-swatches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.wz-swatch, .wz-font, .wz-option {
  display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; transition: border-color .12s ease, background .12s ease;
}
.wz-swatch:hover, .wz-font:hover, .wz-option:not([disabled]):hover { border-color: var(--line-strong); background: var(--hover); }
.wz-swatch.active, .wz-font.active, .wz-option.active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.wz-swatch .chips { display: inline-flex; flex: none; }
.wz-swatch > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.wz-swatch .chips i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); margin-left: -5px; }
.wz-swatch .chips i:first-child { margin-left: 0; }
.wz-contrast { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.wz-contrast .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.wz-contrast.ok .dot { background: var(--ok); }
.wz-contrast.warn { color: #8f1d20; }
.wz-contrast.warn .dot { background: var(--danger); }

.wz-fonts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.wz-font .sample { font-size: 30px; font-weight: 600; width: 46px; flex: none; text-align: center; line-height: 1; }
.wz-font b, .wz-option b { display: block; font-weight: 500; }
.wz-font small, .wz-option small { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--ink-2); line-height: 1.4; }

.wz-tones { display: flex; flex-wrap: wrap; gap: 6px; }
.wz-tone { height: 30px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--ink-2); }
.wz-tone:hover { color: var(--ink); }
.wz-tone.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.wz-option { align-items: flex-start; padding: 12px 14px; }
.wz-option[disabled] { opacity: .55; cursor: default; }
.wz-option .radio { width: 16px; height: 16px; margin-top: 2px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface); }
.wz-option.active .radio { border: 5px solid var(--ink); }

.wz-preview { position: sticky; top: 32px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 10px 10px; }
.wz-preview-label { font-size: 12px; font-weight: 500; color: var(--ink-3); padding: 2px 4px 10px; }
#wz-preview-main .mini-preview { margin: 0 auto; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 10px 26px rgba(0,0,0,.12); }
.wz-preview-row { display: flex; gap: 12px; margin-top: 12px; justify-content: center; }
.wz-preview-row .mini-preview { border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.1); }

@media (max-width: 1000px) {
  .wz { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .wz-preview { position: static; order: -1; }
  .wz-swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wz-fonts { grid-template-columns: minmax(0, 1fr); }
}

/* ————— Webhooks / MCP (Settings) ————— */
.hook-row { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.hook-events { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.delivery-row { font-size: 12.5px; flex-wrap: nowrap; gap: 8px; }
.delivery-row .chip { margin-right: 4px; }
.hint-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--paper); }
.hint-box summary { cursor: pointer; font-weight: 500; font-size: 13px; }
.hint-box .field-hint { margin-top: 8px; }
.code-line { margin-top: 8px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; white-space: pre-wrap; word-break: break-all; font-size: 11.5px; }

/* audit log */
.audit-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; border-bottom: 1px solid var(--line); }
.audit-filters label { min-width: 130px; }
.audit-filters label.grow { flex: 1; min-width: 200px; }
.audit-table td { vertical-align: top; font-size: 13px; }
.audit-table .nowrap { white-space: nowrap; }
.audit-table .small, .small { font-size: 11.5px; }
.audit-row.has-details { cursor: pointer; }
.audit-detail td { background: var(--surface-2); }
.audit-json { margin: 8px 0 0; white-space: pre-wrap; word-break: break-word; font-size: 11.5px; }
.chip.ch-dashboard { background: var(--surface-2); color: var(--ink-2); }
.chip.ch-api { background: var(--info-tint); color: var(--info); }
.chip.ch-mcp { background: #e6e1f3; color: #5a4697; }
.chip.ch-system { background: var(--amber-tint); color: #7a4f00; }
.chip.ch-none { background: transparent; color: var(--ink-3); }
.audit-table td:nth-child(5) { min-width: 280px; }
table.list .nowrap { white-space: nowrap; }
