:root {
  --bg: #f3f4f6;
  --paper: #f5f6f8;
  --surface: #ffffff;
  --ink: #0b0d12;
  --graphite: #5a6070;
  --muted: #8a909c;
  --hairline: #e4e6eb;
  --code-bg: #0e1117;
  --code-line: #232834;
  --code-text: #c9ced8;
  --code-str: #b6e3a8;
  --live: #12b76a;
  --warn: #b54708;
  --warn-bg: #fff4e5;
  --danger: #d92d20;
  --card-shadow: 0 1px 2px rgba(11, 13, 18, .04), 0 8px 24px -16px rgba(11, 13, 18, .18);

  --display: "Funnel Display", ui-sans-serif, system-ui, sans-serif;
  --body: "Funnel Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 15.5px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg, video { display: block; }
a { color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
h1[tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: 20px; box-shadow: var(--card-shadow); }

/* Shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 26px;
  padding: 22px 14px; background: var(--surface); border-right: 1px solid var(--hairline);
}
.brand { display: inline-flex; align-items: center; gap: 8px; padding: 0 8px; text-decoration: none; font: 700 20px/1 var(--display); letter-spacing: -0.03em; }
.brand-mark { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.brand-mark circle { fill: var(--ink); stroke: none; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  position: relative; display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 10px; border-radius: 10px;
  font-size: 15px; font-weight: 500; color: var(--graphite); text-decoration: none;
}
.side-nav a:hover { background: var(--paper); color: var(--ink); }
.side-nav a[aria-current="page"] { background: var(--paper); color: var(--ink); }
.side-nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-nav .nav-new { margin-bottom: 12px; height: 44px; justify-content: center; background: var(--ink); color: #fff; font-weight: 600; border-radius: 12px; }
.side-nav .nav-new:hover, .side-nav .nav-new[aria-current="page"] { background: #262a33; color: #fff; }
.nav-count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center; background: var(--ink); color: #fff;
  font: 500 11.5px/1 var(--mono);
}
.nav-count:empty { display: none; }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.help-card {
  position: relative; display: block; width: 100%; height: 108px; padding: 0; border: 0; border-radius: 14px; overflow: hidden; cursor: pointer;
  background: var(--ink); text-align: left;
}
.help-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 62% 30%; opacity: .55; transition: opacity .2s ease, transform .4s ease; }
.help-card:hover img { opacity: .7; transform: scale(1.03); }
.help-play { position: absolute; left: 12px; top: 12px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #fff; }
.help-play svg { width: 14px; height: 14px; fill: var(--ink); margin-left: 2px; }
.help-text { position: absolute; left: 12px; bottom: 10px; color: #fff; font: 600 14.5px/1.2 var(--display); }
.help-text em { font: 400 12px/1 var(--mono); opacity: .75; font-style: normal; margin-left: 4px; }
.plan { padding: 12px 14px; border-radius: 14px; background: var(--paper); }
.plan-top { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.plan-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12.5px; color: var(--graphite); }
.plan-row span:first-child { display: inline-flex; align-items: center; gap: 5px; }
.plan-row img { width: 12px; height: 12px; }
.plan-usage { font: 500 12px/1.4 var(--mono); color: var(--graphite); }
.meter { margin-top: 5px; height: 5px; border-radius: 999px; background: #e4e6eb; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--ink); border-radius: inherit; transition: width .3s ease; }
.meter span.full { background: var(--warn); }
.side-legal { display: flex; gap: 10px; flex-wrap: wrap; padding: 0 4px; }
.side-legal a { font-size: 12px; color: var(--muted); text-decoration: none; }
.side-legal a:hover { color: var(--ink); }

/* Main */
.main { padding: 32px 36px 96px; }
.view { max-width: 1060px; margin: 0 auto; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.view-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.block-title { margin: 32px 0 12px; font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--graphite); }
.lock-note { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--graphite); }
.lock-note svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px; cursor: pointer;
  border: 1px solid transparent; font: 600 15px/1 var(--body); text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: #262a33; }
.btn-line { background: var(--surface); border-color: var(--hairline); }
.btn-line:hover { border-color: #b9bec8; }
.btn:disabled { opacity: .3; cursor: default; }
.link-btn { border: 0; background: none; padding: 0; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--graphite); text-decoration: none; }
.link-btn:hover { color: var(--ink); }

.demo-banner { max-width: 1060px; margin: 0 auto 20px; padding: 10px 14px; border-radius: 12px; background: #fff7e6; border: 1px solid #f6d79b; color: #7a4b00; font-size: 14px; }
.demo-banner a { color: inherit; font-weight: 600; margin-left: 6px; }

/* Composer */
.compose-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.composer { display: flex; flex-direction: column; gap: 16px; padding: 20px; }

.accts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.acct-btn {
  position: relative; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; background: none;
  transition: opacity .15s ease, transform .15s ease;
}
.acct-btn .av { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px transparent; transition: box-shadow .15s ease, filter .15s ease; }
.acct-btn .badge { position: absolute; right: -3px; bottom: -3px; width: 22px; height: 22px; padding: 3px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(11, 13, 18, .2); object-fit: contain; }
.acct-btn[aria-pressed="false"] .av { filter: grayscale(1); opacity: .45; }
.acct-btn[aria-pressed="false"] .badge { filter: grayscale(1); opacity: .6; }
.acct-btn[aria-pressed="true"] .av { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.acct-btn:hover { transform: translateY(-1px); }
.acct-add {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  border: 1.5px dashed #c9cdd5; color: var(--graphite); text-decoration: none; font-size: 22px; line-height: 1;
}
.acct-add:hover { border-color: var(--ink); color: var(--ink); }
.accts-empty { display: inline-flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--graphite); }
.accts-empty a { color: var(--ink); font-weight: 600; text-decoration: none; }

.drop {
  position: relative; display: block; min-height: 168px; padding: 14px; border-radius: 16px; cursor: pointer;
  background: var(--paper); border: 1.5px dashed #d3d7de;
  transition: border-color .15s ease, background-color .15s ease;
}
.drop:hover, .drop.over { border-color: var(--ink); background: #eef0f3; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.drop-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.drop-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); box-shadow: var(--card-shadow); }
.drop-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { font-size: 15px; font-weight: 600; }
.drop.has-media { min-height: 0; }
.drop.has-media .drop-empty { display: none; }
.drop-preview { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { position: relative; width: 96px; height: 128px; border-radius: 12px; overflow: hidden; background: #dfe2e7; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-badge { position: absolute; left: 6px; bottom: 6px; padding: 2px 6px; border-radius: 6px; background: rgba(11, 13, 18, .72); color: #fff; font: 500 11px/1.3 var(--mono); }
.thumb-remove {
  position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; border: 0; cursor: pointer;
  background: rgba(11, 13, 18, .72); color: #fff; font-size: 15px; line-height: 1;
}
.thumb-add { display: grid; place-items: center; width: 96px; height: 128px; border-radius: 12px; border: 1.5px dashed #c9cdd5; color: var(--graphite); font-size: 24px; background: var(--surface); }

.caption-box { border: 1px solid var(--hairline); border-radius: 16px; background: var(--surface); transition: border-color .15s ease, box-shadow .15s ease; }
.caption-box:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.caption-box textarea { display: block; width: 100%; min-height: 104px; padding: 14px 16px 6px; border: 0; resize: vertical; background: transparent; font-size: 16px; line-height: 1.5; }
.caption-box textarea:focus { outline: none; }
.caption-foot { display: flex; justify-content: flex-end; padding: 0 14px 10px; font: 500 12.5px/1 var(--mono); color: var(--muted); }
.caption-foot .over { color: var(--danger); }

/* One expandable row per selected platform */
.plats { display: flex; flex-direction: column; border: 1px solid var(--hairline); border-radius: 16px; overflow: hidden; }
.plats:empty { display: none; }
.plat + .plat { border-top: 1px solid var(--hairline); }
.plat summary {
  display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 8px 14px; cursor: pointer; list-style: none;
}
.plat summary::-webkit-details-marker { display: none; }
.plat summary:hover { background: #fafafb; }
.plat summary > img { width: 22px; height: 22px; object-fit: contain; flex: none; }
.plat-name { font-weight: 600; font-size: 15px; }
.plat-as { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--paper); color: var(--graphite); font: 500 12px/1 var(--mono); white-space: nowrap; }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-bad { background: #fef0ef; color: var(--danger); }
.chip-ok { background: #e7f7ef; color: #067647; }
.chev { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
details[open] > summary .chev { transform: rotate(180deg); }
.plat-body { display: flex; flex-direction: column; gap: 4px; padding: 4px 14px 14px 46px; }
.plat-body textarea {
  width: 100%; min-height: 64px; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: 12px; resize: vertical;
  background: var(--paper); font-size: 14.5px;
}
.plat-body textarea:focus { outline: none; border-color: var(--ink); background: var(--surface); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; font-size: 14px; }
.set-row + .set-row { border-top: 1px solid #eef0f3; }
.set-row > span { color: var(--graphite); }
.set-row select, .set-row input[type="text"] { height: 36px; padding: 0 10px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--surface); font-size: 14px; }
.set-row select { min-width: 150px; }
.set-row input[type="text"] { flex: 1; max-width: 340px; }
.set-row select:focus, .set-row input[type="text"]:focus { outline: none; border-color: var(--ink); }
.set-row select.missing { border-color: #f2b56b; background: var(--warn-bg); }
.toggles { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.toggle { position: relative; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--hairline); background: var(--surface); font-size: 13.5px; font-weight: 500; color: var(--graphite); transition: all .15s ease; }
.toggle input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.toggle input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.set-note { font-size: 12.5px; color: var(--muted); padding-top: 4px; }
.set-note:empty { display: none; }
.link-note { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-size: 13.5px; }
.link-note:empty { display: none; }
.link-note b { font-weight: 600; }

.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.when { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: #eceef2; }
.seg button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border: 0; border-radius: 9px; cursor: pointer; background: transparent;
  font-size: 14.5px; font-weight: 500; color: var(--graphite);
}
.seg svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.seg button[aria-checked="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(11, 13, 18, .12); }
.seg-count { margin-left: 2px; font: 500 12px/1 var(--mono); color: var(--muted); }
.when-pick { display: flex; gap: 6px; }
.when-pick input { height: 40px; padding: 0 10px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--surface); font-size: 14px; }
.when-pick input:focus { outline: none; border-color: var(--ink); }
.btn-submit { min-width: 168px; height: 46px; border-radius: 13px; font-size: 15.5px; }
.form-note { font-size: 13.5px; color: var(--warn); text-align: right; margin-top: -8px; }
.form-note:empty { display: none; }

/* Live preview */
.preview { position: sticky; top: 24px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.preview-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.preview-tabs button {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--hairline); background: var(--surface);
}
.preview-tabs button img { width: 18px; height: 18px; object-fit: contain; }
.preview-tabs button[aria-selected="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.phone { border-radius: 22px; overflow: hidden; background: #111; aspect-ratio: 9 / 16; position: relative; color: #fff; }
.phone-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #6b7280; }
.phone-empty svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.phone > img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.phone .shade { position: absolute; inset: 40% 0 0; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); }
.phone .meta { position: absolute; left: 14px; right: 56px; bottom: 16px; }
.phone .who { font-weight: 700; font-size: 14px; }
.phone .cap { margin-top: 4px; font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.phone .rail { position: absolute; right: 10px; bottom: 18px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.phone .rail svg { width: 26px; height: 26px; fill: #fff; opacity: .95; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }
.phone .top { position: absolute; left: 0; right: 0; top: 12px; display: flex; justify-content: center; gap: 14px; font-size: 13px; font-weight: 600; opacity: .9; }
.phone .top span:first-child { opacity: .6; }
.phone-feed { background: var(--surface); color: var(--ink); aspect-ratio: auto; min-height: 420px; padding: 14px; border: 1px solid var(--hairline); }
.feed-head { display: flex; align-items: center; gap: 10px; }
.feed-head img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.feed-head b { display: block; font-size: 14px; }
.feed-head span { font-size: 12.5px; color: var(--muted); }
.feed-text { margin-top: 10px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.feed-media { margin-top: 10px; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 14px; }
.feed-actions { display: flex; justify-content: space-between; margin-top: 12px; color: var(--muted); }
.feed-actions svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }

/* Posts */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.post-card { position: relative; overflow: hidden; display: flex; flex-direction: column; }
.post-media { position: relative; aspect-ratio: 4 / 5; background: var(--paper); display: grid; place-items: center; }
.post-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.post-media .txt { padding: 20px; font: 600 16px/1.35 var(--display); color: var(--graphite); }
.post-status {
  position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px;
  border-radius: 999px; background: rgba(255, 255, 255, .92); font-size: 12.5px; font-weight: 600; backdrop-filter: blur(6px);
}
.post-status svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.post-status.posted { color: #067647; }
.post-cancel {
  position: absolute; right: 10px; top: 10px; width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: rgba(11, 13, 18, .6); color: #fff; font-size: 16px; line-height: 1;
  opacity: 0; transition: opacity .15s ease;
}
.post-card:hover .post-cancel, .post-cancel:focus-visible { opacity: 1; }
.post-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.post-when { font: 500 12px/1 var(--mono); color: var(--graphite); }
.post-caption { font-size: 14.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }
.post-icons { display: flex; gap: 5px; }
.post-icons img { width: 18px; height: 18px; object-fit: contain; }
.empty { grid-column: 1 / -1; padding: 56px 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; color: var(--graphite); }
.empty-art { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--surface); box-shadow: var(--card-shadow); }
.empty-art svg { width: 28px; height: 28px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }

/* Accounts */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.acct-card { display: flex; align-items: center; gap: 12px; padding: 14px; }
.acct-card .avwrap { position: relative; flex: none; }
.acct-card .av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.acct-card .badge { position: absolute; right: -3px; bottom: -3px; width: 20px; height: 20px; padding: 3px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(11, 13, 18, .2); object-fit: contain; }
.acct-card b { display: block; font-size: 15px; }
.acct-card span { font-size: 13px; color: var(--muted); }
.acct-card .unlink { margin-left: auto; width: 32px; height: 32px; border-radius: 9px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.acct-card .unlink:hover { background: #fef0ef; color: var(--danger); }
.acct-card .unlink svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.acct-none { grid-column: 1 / -1; padding: 22px; text-align: center; color: var(--graphite); }
.connect-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.connect-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 118px;
  border-radius: 18px; cursor: pointer; background: var(--surface); border: 1px solid var(--hairline); box-shadow: var(--card-shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.connect-tile:hover { transform: translateY(-2px); border-color: #c9cdd5; }
.connect-tile img { width: 34px; height: 34px; object-fit: contain; }
.connect-tile strong { font-size: 14px; font-weight: 600; }
.connect-tile .plus { position: absolute; right: 10px; top: 10px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); color: var(--graphite); font-size: 15px; line-height: 1; }
.connect-tile:disabled { cursor: default; opacity: .45; transform: none; }

/* API & agents */
.api-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font: 600 16px/1 var(--display); }
.card-title svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.key-card, .agent-card { padding: 20px; }
.key-field { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 14px; border-radius: 12px; background: var(--paper); border: 1px solid var(--hairline); }
.key-field code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 14px/1.4 var(--mono); }
.key-btn { flex: none; height: 34px; padding: 0 13px; border-radius: 9px; cursor: pointer; border: 1px solid var(--hairline); background: var(--surface); font-size: 13.5px; font-weight: 600; }
.key-btn:hover { border-color: #b9bec8; }
.key-btn-ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.key-btn-ink:hover { background: #262a33; }
.key-foot { display: flex; gap: 16px; margin-top: 12px; }

.agent-picks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.agent-pick {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 74px; border-radius: 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--hairline); font-size: 12.5px; font-weight: 500; color: var(--graphite);
}
.agent-pick img { width: 24px; height: 24px; object-fit: contain; }
.agent-pick:hover { border-color: #b9bec8; }
.agent-pick[aria-selected="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); color: var(--ink); }
.agent-how { margin: 14px 0 8px; }
.agent-how summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; font: 500 13px/1 var(--mono); color: var(--graphite); }
.agent-how summary::-webkit-details-marker { display: none; }
.agent-how p { margin-top: 8px; font-size: 14px; color: var(--graphite); }
.code-card { position: relative; background: var(--code-bg); color: var(--code-text); border-radius: 14px; overflow: hidden; }
.code-copy { position: absolute; right: 8px; top: 8px; height: 28px; background: #161b24; border-color: var(--code-line); color: var(--code-text); font-size: 12.5px; }
.code-copy:hover { background: #1d2330; color: #fff; }
.code { margin: 0; padding: 16px 70px 16px 16px; font: 400 12.5px/1.7 var(--mono); overflow-x: auto; white-space: pre; }
.t-str { color: var(--code-str); }

/* Dialogs */
.dialog {
  width: min(92vw, 400px); padding: 24px; border: 0; border-radius: 22px;
  box-shadow: 0 30px 80px -20px rgba(11, 13, 18, .45);
}
.dialog::backdrop { background: rgba(11, 13, 18, .35); backdrop-filter: blur(2px); }
.dialog h2 { font-size: 21px; font-weight: 700; }
.dialog-sub { margin-top: 4px; font-size: 14.5px; color: var(--graphite); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.dialog-center { text-align: center; }
.dialog-center .dialog-actions { justify-content: center; }
.connect-art { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center; background: var(--paper); }
.connect-logo { width: 40px; height: 40px; object-fit: contain; }
.publish-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.publish-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--paper); font-size: 14.5px; }
.publish-list .avwrap { position: relative; }
.publish-list .av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.publish-list .badge { position: absolute; right: -4px; bottom: -4px; width: 16px; height: 16px; padding: 2px; border-radius: 50%; background: #fff; object-fit: contain; }
.publish-list .handle { color: var(--graphite); font-size: 13.5px; }
.state { margin-left: auto; width: 22px; height: 22px; display: grid; place-items: center; flex: none; }
.state-wait { border: 2px solid #dfe2e7; border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
.state-ok { border-radius: 50%; background: var(--live); color: #fff; animation: pop .3s cubic-bezier(.3, 1.8, .5, 1); }
.state-ok svg, .state-later svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.state-later { border-radius: 50%; background: var(--ink); color: #fff; animation: pop .3s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(.4); } to { transform: scale(1); } }
.dialog-video { width: min(94vw, 960px); padding: 0; background: #000; overflow: visible; }
.dialog-video video { width: 100%; border-radius: 16px; background: #000; aspect-ratio: 16 / 10; }
.video-close { position: absolute; right: -14px; top: -14px; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; background: #fff; font-size: 20px; line-height: 1; box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 50; transform: translate(-50%, 20px);
  padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14.5px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Narrower screens */
@media (max-width: 1100px) {
  .compose-grid { grid-template-columns: minmax(0, 1fr) 270px; }
  .api-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .compose-grid { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; flex-direction: row; align-items: flex-start; }
  .preview-tabs { flex-direction: column; }
  .phone { width: 220px; }
  .phone-feed { width: 260px; min-height: 0; }
}
@media (max-width: 820px) {
  .shell { display: block; }
  .side {
    position: sticky; top: 0; z-index: 10; height: auto;
    flex-direction: row; align-items: center; justify-content: space-between; gap: 12px;
    /* No backdrop-filter here: it would trap the fixed tab bar inside this bar. */
    padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--hairline);
  }
  .side-foot { margin: 0; flex-direction: row; }
  .plan, .side-legal { display: none; }
  .help-card { width: 40px; height: 40px; border-radius: 50%; }
  .help-card img, .help-text { display: none; }
  .help-play { left: 4px; top: 4px; background: var(--paper); }
  .side-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    flex-direction: row; justify-content: space-around; gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96); border-top: 1px solid var(--hairline);
  }
  .side-nav a { flex: 1; flex-direction: column; justify-content: center; gap: 3px; height: 54px; padding: 0; font-size: 11.5px; background: none; }
  .side-nav a[aria-current="page"] { background: none; color: var(--ink); }
  .side-nav .nav-new { margin: 0; height: 54px; background: none; color: var(--graphite); font-weight: 500; }
  .side-nav .nav-new:hover, .side-nav .nav-new[aria-current="page"] { background: none; color: var(--ink); }
  .side-nav svg { width: 22px; height: 22px; }
  .nav-count { position: absolute; top: 4px; left: 50%; margin-left: 6px; }
  .main { padding: 16px 12px 110px; }
  .composer { padding: 14px; }
  .plat-body { padding-left: 14px; }
  .preview { display: none; }
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .post-cancel { opacity: 1; }
  .agent-picks { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .btn-submit { flex: 1; }
  .toast { bottom: 90px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
