/* SocialShadow web workspace: Apple-grade system look.
   Grouped surfaces on a true-black (or light grey) canvas, hairline separators
   only where they mean something, one accent (system blue), SF Pro on Apple
   devices and Inter elsewhere. */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("/static/fonts/inter-400.woff2?v=8909904ab6c8") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("/static/fonts/inter-600.woff2?v=f9a06e79cd3a") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("/static/fonts/inter-700.woff2?v=6f56409fd3d6") format("woff2"); }

:root {
  --bg: #000000;            /* canvas */
  --panel: #1C1C1E;         /* menus, sheets, controls on canvas */
  --card: #1C1C1E;          /* grouped surface */
  --card-hover: #232325;
  --raised: #2C2C2E;        /* controls on a surface */
  --fill: rgba(118, 118, 128, .24);
  --fill-soft: rgba(118, 118, 128, .16);
  --line: rgba(84, 84, 88, .55);
  --text: #F5F5F7;
  --muted: rgba(235, 235, 245, .62);
  --faint: rgba(235, 235, 245, .32);
  --accent: #0A84FF;
  --accent-soft: rgba(10, 132, 255, .16);
  --ok: #30D158;
  --warn: #FF9F0A;
  --danger: #FF453A;
  --article: var(--muted); --x: var(--text); --facebook: var(--text); --substack: var(--text);
  --radius: 18px;
  --shadow-pop: 0 1px 1px rgba(0,0,0,.2), 0 18px 48px rgba(0,0,0,.55);
  --shadow-control: 0 1px 3px rgba(0, 0, 0, .25);
  --shadow-art: 0 0 0 1px color-mix(in srgb, var(--line) 60%, transparent), 0 10px 28px rgba(0, 0, 0, .28);
  --scrim: rgba(0, 0, 0, .5);
  --editor-bg: #0c0d12;
  color-scheme: dark;
}
/* Light: chosen in the sidebar (theme.js sets data-theme before the first paint), or the
   device's setting when the page runs without scripts. */
:root[data-theme="light"] {
    --bg: #F5F5F7; --panel: #FFFFFF; --card: #FFFFFF; --card-hover: #FBFBFD; --raised: #F2F2F4;
    --fill: rgba(118, 118, 128, .12); --fill-soft: rgba(118, 118, 128, .08);
    --line: rgba(60, 60, 67, .14); --text: #1D1D1F; --muted: #6E6E73; --faint: #A1A1A6;
    --accent: #0071E3; --accent-soft: rgba(0, 113, 227, .1);
    --ok: #248A3D; --warn: #C93400; --danger: #D70015;
    --shadow-pop: 0 1px 2px rgba(0,0,0,.06), 0 16px 40px rgba(0,0,0,.14);
    color-scheme: light;
    --shadow-control: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .06);
    --shadow-art: 0 0 0 1px rgba(0, 0, 0, .06), 0 10px 24px rgba(0, 0, 0, .12);
    --scrim: rgba(0, 0, 0, .32);
    --editor-bg: #e9e9ee;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #F5F5F7; --panel: #FFFFFF; --card: #FFFFFF; --card-hover: #FBFBFD; --raised: #F2F2F4;
    --fill: rgba(118, 118, 128, .12); --fill-soft: rgba(118, 118, 128, .08);
    --line: rgba(60, 60, 67, .14); --text: #1D1D1F; --muted: #6E6E73; --faint: #A1A1A6;
    --accent: #0071E3; --accent-soft: rgba(0, 113, 227, .1);
    --ok: #248A3D; --warn: #C93400; --danger: #D70015;
    --shadow-pop: 0 1px 2px rgba(0,0,0,.06), 0 16px 40px rgba(0,0,0,.14);
    color-scheme: light;
    --shadow-control: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .06);
    --shadow-art: 0 0 0 1px rgba(0, 0, 0, .06), 0 10px 24px rgba(0, 0, 0, .12);
    --scrim: rgba(0, 0, 0, .32);
    --editor-bg: #e9e9ee;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI Variable Text", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; letter-spacing: -.005em; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 15px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--card); border-radius: 22px; padding: 30px;
  display: grid; gap: 14px; box-shadow: var(--shadow-pop); }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.login-card input { background: var(--fill-soft); border: 1px solid transparent; border-radius: 10px; padding: 10px 12px; }
.login-card input:focus { border-color: var(--accent); outline: none; }
.error { color: var(--danger); min-height: 1em; margin: 0; font-size: 13px; }

/* shell */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; padding: 22px 14px;
  display: flex; flex-direction: column; gap: 22px; background: var(--bg); border-right: 1px solid var(--line); }
.sidebar .logo { padding: 0 6px; }
.sidebar h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 6px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px; }
.chip { border: 0; background: var(--fill-soft); border-radius: 999px; padding: 6px 12px;
  font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text); }
.chip:hover { background: var(--fill); }
.chip[aria-pressed="true"] { background: var(--accent); color: #fff; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }

.main { min-width: 0; max-width: 800px; width: 100%; padding: 0 28px 72px; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 -28px; padding: 18px 28px 12px;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px); }
.heading-wrap { flex: 1 1 100%; min-width: 0; margin-bottom: 4px; }
.title-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.title-row h1 { min-width: 0; }
.topbar h1 { font-size: 26px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subheading { margin: 3px 0 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
/* Feed: the bar is just search and filters (title kept for screen readers only). */
.topbar[data-tab="feed"] { padding-top: 14px; }
.topbar[data-tab="feed"] .heading-wrap { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; }
.topbar[data-tab="feed"] ~ * .new-bar, .topbar[data-tab="feed"] + * .new-bar { top: 70px; }
.controls .status { order: 10; }
#search { background: var(--fill-soft); border: 1px solid transparent; border-radius: 10px;
  padding: 7px 12px 7px 32px; min-width: 100px; width: auto; flex: 1 1 140px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 11px 50%; }
#search:focus { border-color: var(--accent); outline: none; }

.btn { border: 0; background: var(--fill-soft); border-radius: 10px; padding: 7px 13px; cursor: pointer;
  font-weight: 500; color: var(--text); }
.btn:hover { background: var(--fill); }
.btn.primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn[aria-pressed="true"] { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 18px; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--fill-soft); color: var(--text); }
.status { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
  color: var(--muted); background: var(--fill-soft); border-radius: 999px; padding: 4px 10px 4px 9px; }
.status.live { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.status.down { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.status.live i { background: var(--ok); }
.status.down i { background: var(--warn); }
.mobile-only { display: none; }

/* pop-up buttons (category / source) */
.picker { position: relative; min-width: 0; }
.pop { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; border: 0; cursor: pointer;
  background: var(--fill-soft); border-radius: 10px; padding: 7px 10px 7px 13px; font-weight: 500; }
.pop:hover, .pop[aria-expanded="true"] { background: var(--fill); }
.pop.active { background: var(--accent-soft); color: var(--accent); }
#sort-picker { margin-left: auto; }
#sort-picker .pop-menu { left: auto; right: 0; width: 190px; }
.pop.compact { font-size: 13px; padding: 5px 8px 5px 10px; gap: 4px; border-radius: 8px; background: none; color: var(--muted); }
.pop.compact:hover, .pop.compact[aria-expanded="true"] { background: var(--fill-soft); color: var(--text); }
.pop.compact svg { width: 10px; height: 10px; }
.pop .sort-prefix { color: var(--muted); }
.pop-menu li button[disabled] { cursor: default; color: var(--faint); }
.pop-menu li button[disabled]:hover { background: none; color: var(--faint); }
.pop-menu li button[disabled]:hover small { color: var(--faint); }
.badge.icon img { display: block; width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }
/* Glyph-only logos (no tile of their own) sit on a white disc. */
.badge.icon.substack img, .badge.icon.threads img { background: #fff; padding: 3px; box-sizing: border-box; object-fit: contain; }
.badge.website { width: 16px; height: 16px; justify-content: center; border-radius: 50%; background: var(--fill-soft); }
.badge.website svg { width: 11px; height: 11px; }
.pop .pop-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop svg { flex: none; width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; opacity: .7; }
.pop-menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 220px; max-width: 90vw; max-height: min(420px, 70vh);
  display: flex; flex-direction: column; background: var(--panel); border-radius: 14px; padding: 6px;
  box-shadow: var(--shadow-pop); border: 1px solid var(--line); }
.pop-menu input { margin: 2px 2px 6px; background: var(--fill-soft); border: 1px solid transparent; border-radius: 9px; padding: 7px 10px; }
.pop-menu input:focus { border-color: var(--accent); outline: none; }
.pop-menu ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.pop-menu li { display: flex; align-items: center; gap: 2px; }
.pop-menu li > button:first-child { flex: 1; min-width: 0; }
/* Parent rows: the name hugs its text (capped) so the chevron sits right after it. */
.pop-menu li.has-kids > button:first-child { flex: 0 1 auto; width: auto; max-width: calc(100% - 34px); }
.pop-menu li.has-kids > button:first-child[aria-selected="true"]::after { display: none; }
.pop-menu .twisty { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border: 0; padding: 0;
  background: none; color: var(--text); opacity: .75; border-radius: 8px; cursor: pointer; }
.pop-menu .twisty:hover, .pop-menu .twisty:focus-visible { opacity: 1; }
.pop-menu .twisty:hover, .pop-menu .twisty:focus-visible { background: var(--fill-soft); color: var(--text); outline: none; }
.pop-menu .twisty svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; transition: transform .18s ease; }
.pop-menu .twisty.open svg { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .pop-menu .twisty svg { transition: none; } }
.pop-menu li button.twisty { width: 28px; }
.pop-menu li button { width: 100%; display: flex; align-items: baseline; gap: 8px; text-align: left; background: none;
  border: 0; border-radius: 8px; padding: 7px 10px; cursor: pointer; }
.pop-menu li button.sub { padding-left: 26px; color: var(--muted); }
.pop-menu li button small { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; }
.pop-menu li button:hover, .pop-menu li button:focus-visible { background: var(--accent); color: #fff; outline: none; }
.pop-menu li button:hover small, .pop-menu li button:focus-visible small { color: rgba(255,255,255,.75); }
.pop-menu li button[aria-selected="true"]::after { content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; margin-left: 8px; align-self: center; flex: none; }
.pop-menu li button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.new-bar { position: sticky; top: 112px; z-index: 4; display: block; margin: 4px auto 12px; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; border-radius: 999px; padding: 8px 18px;
  box-shadow: 0 8px 24px rgba(10, 132, 255, .35); }

/* cards */
.feed { display: grid; gap: 10px; margin-top: 4px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px;
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; cursor: pointer; transition: background .15s ease; }
.card:hover { background: var(--card-hover); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.card.fresh { animation: fresh 1.8s ease-out; }
@keyframes fresh { from { background: color-mix(in srgb, var(--accent) 14%, var(--card)); } }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600;
  font-size: 14px; color: #fff; overflow: hidden; background: var(--raised); }
.avatar img { width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 6px; }
.avatar.photo img { object-fit: cover; background: none; padding: 0; }
.meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; color: var(--muted); line-height: 1.3; }
.meta .name { color: var(--text); font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--faint);
  line-height: 1; }
.badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.title { font-weight: 600; font-size: 17px; line-height: 1.32; letter-spacing: -.012em; margin: 5px 0 3px; }
.text { margin: 5px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; position: relative; }
.clamp.open { display: block; -webkit-line-clamp: unset; overflow: visible; }
.card { --text-bg: var(--card); }
.card:hover { --text-bg: var(--card-hover); }
/* Cut: "… See more" over the end of the last line, the text fading out under it. */
.see-more { position: absolute; right: 0; bottom: 0; padding: 0 0 0 2.6em; border: 0; cursor: pointer;
  font: inherit; line-height: inherit; color: var(--muted); font-weight: 600;
  background: linear-gradient(to right, transparent, var(--text-bg) 2.2em); }
.see-more::before { content: "… "; color: var(--text); font-weight: 400; }
.see-more:hover { color: var(--text); }
/* Open: "See less" right after the last word. */
.clamp.open .see-more { position: static; padding: 0 0 0 .35em; background: none; }
.clamp.open .see-more::before { content: none; }
.see-more:focus-visible { outline: 2px solid var(--accent, currentColor); outline-offset: 2px; border-radius: 4px; }
/* Pictures are never cropped: the frame has the picture's shape (wide) or is capped (tall,
   see photoFrame in app.js), and a capped picture sits inside it over a blurred copy. */
.media { position: relative; margin-top: 12px; border-radius: 13px; overflow: hidden; background: var(--raised);
  isolation: isolate; }
/* The frame's size comes from its aspect-ratio (and the feed's height cap); the picture fills
   it exactly and shows whole (contain), so a tall picture is never clipped at the bottom. */
.media .media-photo { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; object-fit: contain; }
.media.feed { width: 100%; max-height: min(70vh, 680px); }
.media.overlaid.capped { width: 100%; max-height: 72vh; }
.media .media-fill { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0;
  transform: scale(1.15); filter: blur(28px) saturate(1.1) brightness(.62); pointer-events: none; }
:root[data-theme="light"] .media .media-fill { filter: blur(28px) saturate(1.1) brightness(.92); }
.foot { display: flex; gap: 16px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.cats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.cat-tag { font-size: 12.5px; color: var(--muted); background: var(--fill-soft); border-radius: 7px; padding: 2px 8px; }
/* "+N": the other categories open in a small list above the tag. */
.cat-tag.more { position: relative; cursor: default; outline: none; }
.cat-more { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 5; display: flex; flex-direction: column; gap: 6px;
  width: max-content; max-width: 240px; padding: 10px 12px; border-radius: 12px; text-align: left;
  background: rgba(28, 28, 30, .94); color: #F5F5F7; font-size: 12.5px; line-height: 1.3; white-space: normal;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.cat-tag.more:hover .cat-more, .cat-tag.more:focus-visible .cat-more { opacity: 1; transform: none; }
.sentinel { height: 1px; }
.feed-msg { text-align: center; color: var(--muted); padding: 24px 0; font-size: 14px; }

/* loading skeletons shaped like cards */
.skeleton-card { cursor: default; }
.skeleton-card:hover { background: var(--card); }
.sk { display: block; border-radius: 7px; background: var(--fill-soft); position: relative; overflow: hidden; }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 7%, transparent), transparent);
  animation: sheen 1.4s ease-in-out infinite; }
@keyframes sheen { to { transform: translateX(100%); } }
.sk-avatar { width: 40px; height: 40px; border-radius: 50%; }
.sk-body { display: grid; gap: 9px; align-content: start; padding-top: 2px; }
.sk-line { height: 11px; }
.sk-line.w30 { width: 30%; } .sk-line.w90 { width: 90%; height: 15px; } .sk-line.w70 { width: 70%; }
.sk-media { height: 210px; border-radius: 13px; margin-top: 4px; }
.skeleton { height: 120px; border-radius: var(--radius); background: var(--card); }
@media (prefers-reduced-motion: reduce) { .sk::after { animation: none; } .card.fresh { animation: none; } }

/* detail sheet */
.overlay { position: fixed; inset: 0; z-index: 20; background: var(--scrim); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; }
.detail { position: relative; width: min(680px, 100%); max-height: 90vh; overflow-y: auto; background: var(--panel);
  border-radius: 24px; padding: 28px; box-shadow: var(--shadow-pop); }
.detail .close { position: absolute; top: 16px; right: 16px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--fill-soft); font-size: 13px; display: grid; place-items: center; padding: 0; }
.pill { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.pill b { color: var(--text); font-weight: 600; }
.pill .avatar { width: 28px; height: 28px; font-size: 11px; }
.pill .avatar img { padding: 3px; }
.pill .avatar.photo img { padding: 0; }
.detail h3 { font-size: 24px; font-weight: 700; letter-spacing: -.022em; line-height: 1.22; margin: 18px 0 10px; }
.detail .text { color: var(--text); font-size: 16px; line-height: 1.55; }
.detail .actions { display: flex; gap: 10px; margin: 20px 0 4px; flex-wrap: wrap; }
.detail .actions a { text-decoration: none; }
/* Links and categories over the expanded image: fade in on hover, fade out slowly. */
.media.overlaid { position: relative; }
.media.overlaid .float { position: absolute; z-index: 2; bottom: 12px; display: flex; align-items: flex-end; opacity: 0;
  transition: opacity .7s ease; pointer-events: none; }
.media.overlaid .float.left { left: 12px; }
.media.overlaid .float.right { right: 12px; max-width: 45%; justify-content: flex-end; }
.media.overlaid:hover .float, .media.overlaid:focus-within .float { opacity: 1; transition-duration: .2s; pointer-events: auto; }
@media (hover: none) { .media.overlaid .float { opacity: 1; pointer-events: auto; } }
.media.overlaid .actions { margin: 0; gap: 8px; }
.media.overlaid .btn { padding: 7px 14px; font-size: 13.5px; }
.media.overlaid .btn:not(.primary) { background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.media.overlaid .cats { margin: 0; justify-content: flex-end; }
.media.overlaid .cat-tag { background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.detail-extras { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.detail-extras .actions, .detail-extras .cats { margin: 0; }
.detail details { margin-top: 14px; color: var(--muted); font-size: 14px; }

@media (max-width: 860px) {
  #sort-picker .pop-menu { left: 0; right: auto; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 15; inset: 0 30% 0 0; min-width: 250px; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--shadow-pop); background: var(--panel); }
  .sidebar.open { transform: none; }
  .mobile-only { display: inline-block; }
  .main { padding: 0 16px 60px; }
  .topbar { margin: 0 -16px; padding: 14px 16px 10px; }
  #search { flex: 1 1 100%; width: auto; }
  .topbar h1 { font-size: 22px; }
  .card { padding: 16px; gap: 12px; }
  .pop-menu { width: min(280px, calc(100vw - 32px)); }
  /* Feed on a phone: menu, search and sort on one row; the three filters share the full next row. */
  .topbar[data-tab="feed"] { padding-top: 10px; row-gap: 8px; }
  .topbar[data-tab="feed"] .controls { display: contents; }
  .topbar[data-tab="feed"] #menu { order: 0; padding-left: 0; }
  .topbar[data-tab="feed"] #search { flex: 1 1 0; order: 1; }
  .topbar[data-tab="feed"] #sort-picker { order: 2; }
  .topbar[data-tab="feed"] .status { order: 3; }
  .topbar[data-tab="feed"]::after { content: ""; order: 4; flex-basis: 100%; }
  .topbar[data-tab="feed"] #cat-picker, .topbar[data-tab="feed"] #source-picker,
  .topbar[data-tab="feed"] #platform-picker { order: 5; flex: 1 1 0; }
  .topbar[data-tab="feed"] .picker .pop:not(.compact) { width: 100%; max-width: none; justify-content: space-between;
    font-size: 13px; padding-left: 10px; padding-right: 8px; }
  .topbar[data-tab="feed"] .pop-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar[data-tab="feed"] ~ #feed-view .new-bar { top: 104px; }
}

/* brand switcher */
.switcher { position: relative; }
.brand-switch { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
  background: var(--card); border: 0; border-radius: 14px; padding: 10px; }
.brand-switch:hover, .brand-switch[aria-expanded="true"] { background: var(--card-hover); }
.brand-avatar { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  font-weight: 600; color: #fff; font-size: 13.5px; }
.switch-text { min-width: 0; flex: 1; display: grid; }
.switch-text b { font-weight: 600; }
.switch-text b, .switch-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch-text small { color: var(--muted); font-size: 12px; }
.brand-menu { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px;
  box-shadow: var(--shadow-pop); max-height: 70vh; overflow-y: auto; }
.brand-menu input { width: 100%; background: var(--fill-soft); border: 1px solid transparent; border-radius: 9px; padding: 8px 10px; }
.brand-menu input:focus { border-color: var(--accent); outline: none; }
.menu-label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 10px 8px 4px; }
#brand-options { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
#brand-options button { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: none;
  border: 0; border-radius: 9px; padding: 7px 8px; cursor: pointer; }
#brand-options button:hover, #brand-options button:focus-visible { background: var(--fill-soft); outline: none; }
#brand-options button[aria-selected="true"] { background: var(--accent-soft); }
#brand-options .opt-text { display: grid; min-width: 0; }
#brand-options b { font-weight: 600; }
#brand-options small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-empty { color: var(--muted); font-size: 13px; padding: 6px 8px; }

/* workspace tabs */
.tabs { display: grid; gap: 2px; }
.tab { display: flex; align-items: center; gap: 11px; background: none; border: 0; border-radius: 10px;
  padding: 9px 10px; cursor: pointer; font-weight: 500; text-align: left; color: var(--text); }
.tab svg { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab:hover { background: var(--fill-soft); }
.tab[aria-current="true"] { background: var(--fill); font-weight: 600; }
.badge-count { margin-left: auto; background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 600; padding: 1px 7px; }
.feed-filters { display: flex; flex-direction: column; gap: 22px; }

/* ---------- sidebar (2026-10-21) ----------
   A quiet column: brand on top, sections, the account at the bottom. Collapses to an icon
   rail (labels show on hover) and remembers it per browser; phones keep the full drawer. */
.sidebar { gap: 18px; padding: 16px 12px 14px; transition: padding .2s ease; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; padding: 0 2px 0 6px; }
.side-head .logo { padding: 0; font-size: 17px; min-width: 0; }
.logo-word { white-space: nowrap; overflow: hidden; }
.side-btn { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: none; color: var(--muted); cursor: pointer; }
.side-btn:hover { background: var(--fill-soft); color: var(--text); }
.side-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.chev-ud { flex: none; width: 14px; height: 14px; fill: none; stroke: var(--faint); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.brand-switch { padding: 9px 10px 9px 9px; border-radius: 13px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 55%, transparent); }
.brand-switch .brand-avatar { width: 32px; height: 32px; border-radius: 9px; font-size: 13px; }
.brand-switch:hover .chev-ud, .brand-switch[aria-expanded="true"] .chev-ud { stroke: var(--muted); }
.switch-text b { font-size: 14.5px; letter-spacing: -.01em; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; color: var(--text);
  font: inherit; font-size: 14px; text-align: left; padding: 8px; border-radius: 9px; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--fill-soft); outline: none; }
.menu-item svg { width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand-menu .menu-item { margin-top: 6px; border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); border-radius: 0 0 9px 9px; padding-top: 10px; }

/* sections */
.tabs { gap: 1px; }
.tab { position: relative; gap: 12px; height: 38px; padding: 0 10px; font-size: 14.5px; color: var(--text); }
.tab svg { flex: none; stroke: var(--muted); transition: stroke .15s ease; }
.tab:hover svg { stroke: var(--text); }
.tab[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tab[aria-current="true"] svg { stroke: var(--accent); }
.tab-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* account */
.sidebar-foot { margin-top: auto; }
.account { position: relative; }
.account-btn { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; color: var(--text);
  font: inherit; text-align: left; padding: 7px 8px; border-radius: 11px; cursor: pointer; }
.account-btn:hover, .account-btn[aria-expanded="true"] { background: var(--fill-soft); }
.account-avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--fill); color: var(--text); font-size: 13px; font-weight: 600; }
.account-text { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.account-text b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-text small { font-size: 12px; color: var(--muted); }
.account-menu { position: absolute; z-index: 30; left: 0; right: 0; bottom: calc(100% + 6px); min-width: 236px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px; box-shadow: var(--shadow-pop); }
.account-menu-head { display: grid; padding: 6px 8px 8px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.account-menu-head b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-head small { font-size: 12px; color: var(--muted); }
.account-menu .menu-label { margin: 10px 8px 6px; }
.account-menu .theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; margin: 0 4px;
  border-radius: 10px; background: var(--fill-soft); }
.account-menu .theme-switch button { display: grid; justify-items: center; gap: 3px; padding: 7px 4px 6px; border: 0; border-radius: 8px;
  background: none; color: var(--muted); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; }
.account-menu .theme-switch button:hover { color: var(--text); }
.account-menu .theme-switch button[aria-checked="true"] { background: var(--raised); color: var(--text); box-shadow: var(--shadow-control); }
.account-menu .theme-switch svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.menu-sep { height: 1px; margin: 8px 4px; background: color-mix(in srgb, var(--line) 60%, transparent); }

/* collapsed: an icon rail */
@media (min-width: 861px) {
  .shell { transition: grid-template-columns .2s ease; }
  .shell.side-collapsed { grid-template-columns: 68px minmax(0, 1fr); }
  .side-collapsed .sidebar { padding: 16px 10px 14px; overflow: visible; z-index: 12; }
  .side-collapsed .side-head { flex-direction: column; gap: 10px; padding: 0; }
  .side-collapsed .logo-word, .side-collapsed .switch-text, .side-collapsed .chev-ud, .side-collapsed .tab-label,
  .side-collapsed .account-text { display: none; }
  .side-collapsed .brand-switch { justify-content: center; padding: 6px; box-shadow: none; background: none; }
  .side-collapsed .brand-switch:hover { background: var(--fill-soft); }
  .side-collapsed .brand-menu, .side-collapsed .account-menu { left: calc(100% + 10px); right: auto; width: 280px; }
  .side-collapsed .brand-menu { top: 0; }
  .side-collapsed .account-menu { bottom: 0; }
  .side-collapsed .tab { justify-content: center; padding: 0; }
  .side-collapsed .badge-count { position: absolute; top: 5px; right: 7px; width: 8px; height: 8px; padding: 0; font-size: 0; }
  .side-collapsed .account-btn { justify-content: center; padding: 7px 0; }
  /* labels on hover / keyboard focus */
  .side-collapsed .tab::after { content: attr(data-label); position: absolute; left: calc(100% + 12px); top: 50%;
    transform: translateY(-50%); padding: 5px 9px; border-radius: 7px; background: var(--text); color: var(--bg);
    font-size: 12.5px; font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s ease; z-index: 40; }
  .side-collapsed .tab:hover::after, .side-collapsed .tab:focus-visible::after { opacity: 1; }
}
@media (max-width: 860px) { .side-btn { display: none; } }
@media (prefers-reduced-motion: reduce) { .shell, .sidebar, .tab svg { transition: none; } }


/* draft actions on feed cards */
.actions-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; position: relative; }
.btn.small { padding: 6px 12px; font-size: 13.5px; border-radius: 9px; }
.btn.draft { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chev { display: inline-flex; margin-left: 2px; }
.chev svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.btn.draft { display: inline-flex; align-items: center; gap: 4px; }
.btn.draft:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.hint { font-size: 12.5px; color: var(--muted); }
.pick-menu { position: absolute; z-index: 6; top: calc(100% + 6px); left: 0; min-width: 220px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 5px; box-shadow: var(--shadow-pop); }
.pick-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.pick-menu button:hover { background: var(--accent); color: #fff; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; border-radius: 999px;
  padding: 5px 12px; border: 0; background: var(--fill-soft); cursor: pointer; }
.state.processing { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.state.review { color: var(--accent); background: var(--accent-soft); }
.state.poster_ready { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.state.skipped { color: var(--muted); }
.state.failed { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.spin { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* drafts tab */
.draft-card { background: var(--card); border-radius: var(--radius); padding: 18px;
  display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: start; transition: box-shadow .3s; }
.draft-card.focus { box-shadow: 0 0 0 2px var(--accent); }
.draft-main { display: grid; gap: 12px; min-width: 0; }
.poster-box { position: relative; aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden; background: var(--raised);
  display: grid; place-items: center; }
.poster-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster-skeleton, .poster-empty { display: grid; gap: 8px; place-items: center; text-align: center; padding: 12px;
  color: var(--muted); font-size: 12.5px; }
.poster-empty p { margin: 0; }
.poster-tag { position: absolute; top: 8px; left: 8px; background: var(--ok); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 6px; padding: 2px 7px; }
.hl-options { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.hl-options legend, .field-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.hl-option { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; border: 1px solid transparent;
  background: var(--fill-soft); border-radius: 11px; padding: 9px 11px; cursor: pointer; font-weight: 600; line-height: 1.3; }
.hl-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.hl-option input { margin-top: 3px; accent-color: var(--accent); }
.caption-edit { display: grid; gap: 6px; }
.caption-edit textarea { width: 100%; resize: vertical; background: var(--fill-soft); border: 1px solid transparent; border-radius: 11px;
  padding: 10px; font: inherit; line-height: 1.45; }
@media (max-width: 640px) { .draft-card { grid-template-columns: 1fr; } .poster-box { max-width: 260px; } }
.draft-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.brand-pill { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; }
.brand-pill .brand-avatar { width: 22px; height: 22px; border-radius: 6px; font-size: 11px; }
.draft-headline { font-weight: 600; font-size: 17px; letter-spacing: -.012em; line-height: 1.3; margin: 0; }
.draft-caption { margin: 0; white-space: pre-line; color: var(--text); }
.draft-error { margin: 0; color: var(--danger); font-size: 13.5px; }
.draft-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.skeleton-line { height: 12px; border-radius: 6px; background: var(--fill-soft); }

.toast { position: fixed; z-index: 40; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(520px, calc(100vw - 32px));
  background: var(--raised); color: var(--text); padding: 11px 18px; border-radius: 14px; font-size: 14px; box-shadow: var(--shadow-pop); }
.toast button { margin-left: 10px; background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.poster-col { display: grid; gap: 8px; }
.poster-col .hint { margin: 0; }
.draft-source { background: var(--fill-soft); border-radius: 11px; padding: 9px 11px; font-size: 13px; color: var(--muted); }
.draft-source summary { cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.draft-source p { color: var(--text); white-space: pre-line; margin: 8px 0 0; }
.caption-options { display: grid; gap: 6px; }
.caption-option { background: var(--fill-soft); border-radius: 11px; padding: 8px 10px; display: grid; gap: 6px; justify-items: start; }
.caption-option p { margin: 0; white-space: pre-line; }
.draft-source { min-width: 0; overflow: hidden; }
.draft-source summary { display: block; }
.hl-option span { min-width: 0; overflow-wrap: anywhere; }
.poster-tag.preview { background: var(--muted); }
.detail .detail-post { font-size: 17px; margin-top: 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Manage ----------
   Same language as the Drafts inspector: a quiet heading over each group, one surface per
   group with hairline-separated rows, and a footnote below. No filled tiles inside surfaces. */
.manage { display: grid; gap: 26px; min-width: 0; padding-top: 4px; }
.m-settings-panel, .m-stack { display: grid; gap: 26px; min-width: 0; }
.m-settings-panel:focus-visible { outline: none; }
.m-group { display: grid; gap: 8px; min-width: 0; scroll-margin-top: 120px; }
.m-group-head { margin: 0 0 2px 4px; font-size: 15px; font-weight: 600; letter-spacing: -.008em; color: var(--text); }
.m-surface { background: var(--card); border-radius: 18px; overflow: hidden; min-width: 0; }
.m-surface > * + * { border-top: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.m-foot { margin: 2px 4px 0; font-size: 13px; line-height: 1.45; color: var(--muted); text-wrap: pretty; }
.m-intro { margin: 0 4px -8px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.m-pad { padding: 16px 18px; display: grid; gap: 12px; min-width: 0; }
.m-note { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--muted); }

.m-row { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 18px; min-width: 0; width: 100%;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; }
.m-row.link { cursor: pointer; transition: background .15s ease; }
.m-row.link:hover { background: var(--card-hover); }
.m-row.link:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.m-row.muted .m-text b { font-weight: 500; color: var(--muted); }
.m-lead { flex: none; display: grid; place-items: center; }
.m-lead .brand-avatar { width: 36px; height: 36px; border-radius: 10px; }
.m-lead .badge { color: var(--muted); font-size: 12.5px; }
.m-lead .badge.icon img, .m-lead .badge.website { width: 22px; height: 22px; }
.m-lead .badge.website svg { width: 14px; height: 14px; }
.m-text { display: grid; gap: 1px; flex: 1; min-width: 0; }
.m-text b { font-weight: 600; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-text small { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-text small.warn { color: var(--warn); white-space: normal; }
.m-trail { flex: none; display: flex; align-items: center; gap: 8px; min-width: 0; }
.m-trail.grow { flex: 1 1 60%; justify-content: flex-end; }
.m-chev { flex: none; color: var(--faint); display: inline-flex; }
.m-chev .ico svg { width: 15px; height: 15px; stroke-width: 2; }
.m-flag { font-size: 12px; font-weight: 600; color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent);
  border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.m-done { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.m-done .ico svg { width: 15px; height: 15px; stroke-width: 2.2; }
.m-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); margin: 0 4px; }
.m-dot.ok { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 18%, transparent); }
.m-callout { gap: 10px; min-height: 0; font-size: 14px; line-height: 1.4; color: var(--text);
  background: color-mix(in srgb, var(--warn) 10%, var(--card)); }
.m-callout .ico { color: var(--warn); flex: none; }
.m-callout .ico svg { width: 18px; height: 18px; }
.m-summary .m-text small { white-space: normal; }

/* Inputs that live inside rows: no box of their own until focused. */
.m-inline-input, .m-select, .m-search, .m-count, .m-hex, .m-field textarea, .m-advanced textarea {
  min-width: 0; font: inherit; color: var(--text); background: var(--fill-soft); border: 1px solid transparent;
  border-radius: 10px; padding: 7px 11px; }
.m-inline-input { width: 100%; max-width: 360px; text-align: left; }
.m-inline-input:focus, .m-select:focus, .m-search:focus, .m-count:focus, .m-hex:focus,
.m-field textarea:focus, .m-advanced textarea:focus { border-color: var(--accent); outline: none; }
.m-select { max-width: 220px; padding-right: 8px; font-size: 14px; }
.m-search { width: 100%; padding-left: 32px; background-repeat: no-repeat; background-position: 11px 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); }
.m-count { width: 76px; text-align: center; font-variant-numeric: tabular-nums; }
.m-hex { width: 104px; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.m-hex::placeholder { text-transform: none; }
.m-swatch { position: relative; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; cursor: pointer; flex: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 18%, transparent); }
.m-swatch input { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); border: 0; padding: 0; cursor: pointer; }

/* Overview: add-brand row */
.m-add { gap: 12px; }
.m-add input { flex: 1; min-width: 0; border: 0; background: none; padding: 8px 0; font: inherit; color: var(--text); outline: none; }
.m-plus { width: 36px; height: 36px; border-radius: 10px; color: var(--accent); background: var(--accent-soft); }
.m-plus .ico svg { width: 18px; height: 18px; stroke-width: 2.2; }
.m-add .btn { opacity: 0; pointer-events: none; transition: opacity .15s ease; }
.m-add:focus-within .btn, .m-add:has(input:not(:placeholder-shown)) .btn { opacity: 1; pointer-events: auto; }

/* Brand settings: back + tabs (the app's segmented control, scrollable on narrow screens) */
.m-bar { position: sticky; top: 92px; z-index: 4; display: flex; align-items: center; gap: 12px; min-width: 0;
  margin: -4px -6px -10px; padding: 6px; background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.m-back { flex: none; display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; color: var(--accent);
  font: inherit; font-size: 15px; font-weight: 500; padding: 6px 6px 6px 2px; border-radius: 8px; cursor: pointer; }
.m-back:hover { background: var(--fill-soft); }
.m-back .ico svg { width: 17px; height: 17px; stroke-width: 2; }
.m-tabs-wrap { flex: 1; min-width: 0; display: flex; }
.m-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--fill-soft); max-width: 100%;
  overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.m-tabs::-webkit-scrollbar { display: none; }
.m-tabs button { flex: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap; cursor: pointer; scroll-snap-align: start; }
.m-tabs button:hover { color: var(--text); }
.m-tabs button[aria-selected=true] { background: var(--raised); color: var(--text); box-shadow: var(--shadow-control); }
.m-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Switch (Platforms) */
.m-switch { position: relative; flex: none; width: 51px; height: 31px; border: 0; padding: 0; border-radius: 999px; cursor: pointer;
  background: var(--fill); transition: background .2s ease; }
.m-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .2s ease; }
.m-switch[aria-checked=true] { background: var(--ok); }
.m-switch[aria-checked=true]::after { transform: translateX(20px); }
.m-switch.armed { background: var(--warn); }
.m-switch:disabled { opacity: .5; cursor: progress; }
@media (prefers-reduced-motion: reduce) { .m-switch, .m-switch::after { transition: none; } }

/* Sources */
.m-finder { display: grid; gap: 10px; }
.m-finder .segmented { justify-self: start; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.m-results { max-height: 440px; overflow-y: auto; }
.m-results > * + * { border-top: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }

/* Content profile: label above, the text below it, hint last; boxes grow with what is typed. */
.m-field { display: grid; gap: 6px; align-items: stretch; padding: 14px 18px; cursor: text; }
.m-field-label { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.m-field textarea { width: 100%; resize: none; line-height: 1.45; min-height: calc(1.45em + 16px); max-height: 50vh;
  field-sizing: content; }
.m-field small { font-size: 12.5px; color: var(--muted); }
.m-advanced > summary { list-style: none; }
.m-advanced > summary::-webkit-details-marker { display: none; }
.m-advanced[open] > summary .m-chev { transform: rotate(90deg); }
.m-advanced[open] > summary { border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.m-advanced textarea { width: 100%; resize: vertical; line-height: 1.45; }
.m-card textarea.mono, .m-advanced textarea.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.m-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.m-savebar { position: sticky; bottom: 16px; z-index: 6; justify-self: center; display: flex; align-items: center; gap: 8px;
  padding: 8px 8px 8px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow-pop); font-size: 14px; font-weight: 600; animation: pub-rise .18s ease-out; }
.m-savebar > span { margin-right: 6px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .m-savebar { animation: none; } }

/* Brand template */
.m-template { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 22px; align-items: center; padding: 18px; }
.m-template-art { position: relative; }
.m-template-preview { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 12px; background: var(--raised);
  box-shadow: var(--shadow-art); }
.m-template-empty { width: 100%; aspect-ratio: 4 / 5; border-radius: 12px; background: var(--raised); display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 12px; }
.m-template-main { display: grid; gap: 10px; justify-items: start; min-width: 0; }
.m-template-main > b { font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.m-icon-btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 16px; font-size: 14.5px; }
.m-icon-btn .ico svg { width: 16px; height: 16px; stroke-width: 2; }
.m-tools { display: flex; flex-wrap: wrap; gap: 2px; margin-left: -9px; }
.m-template-editor { position: fixed; inset: 0; width: 100%; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: var(--bg); color: var(--text); }
.m-template-editor[open] { display: flex; flex-direction: column; }
.m-template-editor-head { display: flex; align-items: center; gap: 16px; height: 52px; padding: 0 14px 0 18px; flex: none;
  border-bottom: 1px solid var(--line); font-size: 14px; }
.m-template-editor-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-template-frame { display: block; border: 0; width: 100%; flex: 1; min-height: 0; }

/* Brand kit */
.m-logo-row { min-height: 84px; }
.m-logo { width: 56px; height: 56px; object-fit: contain; border-radius: 12px; display: block;
  background: repeating-conic-gradient(var(--card-hover) 0 25%, var(--raised) 0 50%) 0 0 / 12px 12px; }
.m-logo.empty { display: grid; place-items: center; color: var(--faint); background: var(--fill-soft); }
.m-logo.empty .ico svg { width: 22px; height: 22px; }

/* Suggest form */
.m-form .m-row { min-height: 52px; }
.m-form-foot { justify-content: flex-end; }

/* Status */
.btn.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.btn.danger.armed { background: var(--danger); color: #fff; }
.m-destructive { justify-content: center; min-height: 52px; color: var(--danger); font-weight: 600; cursor: pointer; transition: background .15s ease; }
.m-destructive:hover { background: color-mix(in srgb, var(--danger) 8%, var(--card)); }
.m-destructive.armed { background: var(--danger); color: #fff; }
.m-destructive:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--danger); }

/* ---------- Manage tabs (2026-10-20) ---------- */
.m-tabs-wrap { position: relative; }
.m-tabs-wrap.more-end .m-tabs { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.m-tabs-wrap.more-start .m-tabs { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); }
.m-tabs-wrap.more-start.more-end .m-tabs { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
.btn.ghost { background: none; color: var(--muted); }
.btn.ghost:hover { background: var(--fill-soft); color: var(--text); }
.btn.danger-text { color: var(--danger); }
.btn.danger-text.armed { background: var(--danger); color: #fff; }

/* Categories: picks on top, then one row per category with its subcategories underneath */
.m-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.m-pick { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px 0 14px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; }
.m-pick:not(:has(.m-pick-x)) { padding-right: 14px; }
.m-pick-parent { font-weight: 500; opacity: .78; }
.m-pick-x { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 50%; padding: 0; cursor: pointer;
  background: rgba(255, 255, 255, .18); color: #fff; }
.m-pick-x:hover { background: rgba(255, 255, 255, .3); }
.m-pick-x .ico svg { width: 13px; height: 13px; stroke-width: 2.6; }
.m-cat-list > * + * { border-top: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.m-cat { display: flex; align-items: stretch; min-width: 0; }
.m-cat-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 11px 6px 11px 18px; min-height: 60px;
  border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background .15s ease; }
.m-cat-main:hover, .m-cat-more:hover { background: var(--card-hover); }
.m-cat-main:focus-visible, .m-cat-more:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.m-check { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff;
  box-shadow: inset 0 0 0 1.5px var(--faint); transition: background .15s ease, box-shadow .15s ease; }
.m-check .ico svg { width: 14px; height: 14px; stroke-width: 2.8; }
.m-cat.on .m-check { background: var(--accent); box-shadow: none; }
.m-cat.part .m-check { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.m-cat.on .m-text b { color: var(--text); }
.m-cat-more { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 0 18px 0 12px; border: 0; background: none;
  color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }
.m-cat-more .ico svg { width: 15px; height: 15px; stroke-width: 2; transition: transform .2s ease; }
.m-cat-more[aria-expanded=true] .ico svg { transform: rotate(90deg); }
.m-cat-subs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 14px 56px; }
.m-cat-subs .chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 6px 12px; }
.m-cat-subs .chip .ico svg { width: 13px; height: 13px; stroke-width: 2.6; }
.chip.implied { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.chip[disabled], .m-cat-main[disabled] { opacity: .5; cursor: progress; }

/* Category tiles: 3 across on desktop, 2 on phones; an open tile's subcategories span the row below it */
.m-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); grid-auto-flow: row dense; gap: 8px; padding: 0 14px 14px; }
.m-surface > .m-cat-grid { border-top: 0; }
.m-tile { position: relative; display: flex; flex-direction: column; min-width: 0; border-radius: 14px; background: var(--fill-soft);
  box-shadow: inset 0 0 0 1px transparent; transition: background .15s ease, box-shadow .15s ease; }
.m-tile:hover { background: var(--fill); }
.m-tile.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.m-tile.part { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.m-tile.open { border-bottom-left-radius: 14px; border-bottom-right-radius: 14px; }
.m-tile-main { flex: 1; display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 10px; row-gap: 3px; align-content: start;
  padding: 13px 14px 12px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 14px; }
.m-tile-main:focus-visible, .m-tile-more:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.m-tile-main .m-check { width: 22px; height: 22px; margin-top: -1px; }
.m-tile.on .m-check { background: var(--accent); box-shadow: none; }
.m-tile.part .m-check { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.m-tile-main b { font-size: 14.5px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.m-tile-more { display: flex; align-items: center; gap: 3px; margin: -4px 8px 8px 38px; padding: 4px 8px; align-self: flex-start;
  border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.m-tile-more:hover { background: var(--fill); color: var(--text); }
.m-tile.on .m-tile-more, .m-tile.part .m-tile-more { color: var(--accent); }
.m-tile-more .ico svg { width: 14px; height: 14px; stroke-width: 2.2; transition: transform .2s ease; }
.m-tile-more[aria-expanded=true] .ico svg { transform: rotate(180deg); }
.m-tile-panel { grid-column: 1 / -1; display: grid; gap: 10px; padding: 12px 14px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--raised) 75%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent); }
.m-tile-panel-head { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.m-tile-panel-head b { color: var(--text); font-weight: 600; }
.m-tile-panel { position: relative; margin-top: 4px; }
.m-tile-panel::before { content: ""; position: absolute; top: -7px; left: calc(var(--arrow-x, 50%) - 7px); width: 12px; height: 12px;
  transform: rotate(45deg); border-radius: 2px 0 0 0; background: inherit;
  box-shadow: inset 1px 1px 0 0 color-mix(in srgb, var(--line) 70%, transparent); }
.m-tile.open:not(.on):not(.part) { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 22%, transparent); }
.m-tile-panel .m-cat-subs { padding: 0; }
.m-tile-none { grid-column: 1 / -1; }
.m-tile-more .short { display: none; }
@media (max-width: 760px) {
  .m-cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 0 10px 10px; }
  .m-tile-main { grid-template-columns: minmax(0, 1fr) 20px; padding: 11px 10px 10px 12px; }
  .m-tile-main .m-check { grid-column: 2; grid-row: 1; width: 20px; height: 20px; }
  .m-tile-main b { grid-column: 1; font-size: 14px; }
  .m-tile-more { margin: -2px 6px 6px 4px; }
  .m-tile-more .long { display: none; }
  .m-tile-more .short { display: inline; }
}
@media (prefers-reduced-motion: reduce) { .m-tile, .m-tile-more .ico svg { transition: none; } }

/* Sources */
.m-results { max-height: none; overflow: visible; }
.m-more { justify-content: center; min-height: 48px; }
.m-more .m-text { flex: none; justify-items: center; }
.m-more .m-text b { color: var(--accent); font-size: 14px; }
.m-empty { display: flex; align-items: center; gap: 14px; padding: 18px; }
.m-empty-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--fill-soft); color: var(--muted); }
.m-empty-ico .ico svg { width: 18px; height: 18px; stroke-width: 2.2; }
.m-empty b { font-size: 15px; font-weight: 600; }
.m-empty p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.m-advanced > summary .m-plus { width: 32px; height: 32px; border-radius: 9px; }
.m-advanced[open] > summary .m-chev { transform: rotate(90deg); }

/* Content profile */
.m-intro-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 4px -8px; }
.m-intro-row .m-intro { margin: 0; }
.m-progress { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.m-progress i { position: relative; width: 64px; height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; }
.m-progress i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p); background: var(--accent); border-radius: 2px; }
.m-field-label { display: grid; gap: 1px; }
.m-field-label small { font-size: 12.5px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.m-field textarea::placeholder, .m-tag-input::placeholder { color: var(--faint); }
.m-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 38px; padding: 5px; border-radius: 10px;
  background: var(--fill-soft); border: 1px solid transparent; cursor: text; }
.m-tags:focus-within { border-color: var(--accent); }
.m-tag { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 10px; border-radius: 7px;
  background: var(--raised); font-size: 13.5px; font-weight: 500; max-width: 100%; }
.m-tag button { display: grid; place-items: center; width: 20px; height: 20px; border: 0; padding: 0; border-radius: 5px;
  background: none; color: var(--muted); cursor: pointer; }
.m-tag button:hover { background: var(--fill); color: var(--text); }
.m-tag .ico svg { width: 12px; height: 12px; stroke-width: 2.6; }
.m-tag-input { flex: 1; min-width: 140px; border: 0; background: none; outline: none; padding: 3px 6px; font: inherit; color: var(--text); }
.m-stepper { display: inline-flex; align-items: center; border-radius: 10px; background: var(--fill-soft); padding: 2px; }
.m-step { width: 34px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit;
  font-size: 18px; line-height: 1; cursor: pointer; }
.m-step:hover:not(:disabled) { background: var(--fill); }
.m-step:disabled { color: var(--faint); cursor: default; }
.m-step-value { min-width: 30px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.m-step-value.default { color: var(--muted); font-weight: 500; }

/* Brand template */
.m-template { grid-template-columns: 220px minmax(0, 1fr); gap: 28px; padding: 22px; align-items: start; }
.m-template-art { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 14px; transition: transform .2s ease; }
.m-template-art:hover { transform: translateY(-2px); }
.m-template-art:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.m-template-preview, .m-template-empty { border-radius: 14px; }
.m-template-empty { display: grid; gap: 8px; place-content: center; justify-items: center; }
.m-template-main { gap: 12px; padding-top: 6px; }
.m-template-main > b { font-size: 19px; letter-spacing: -.02em; }
.m-template-main .m-note { max-width: 46ch; }
.m-alt { display: grid; gap: 8px; margin-top: 14px; padding-top: 16px; width: 100%; border-top: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.m-alt > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.m-alt .m-icon-btn { height: 34px; padding: 0 13px; font-size: 13.5px; }
@media (prefers-reduced-motion: reduce) { .m-template-art { transition: none; } .m-template-art:hover { transform: none; } }

/* Brand kit: fields beside a live poster preview */
.m-kit { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 26px; align-items: start; }
.m-kit-fields { display: grid; gap: 26px; min-width: 0; }
.m-kit-figure { margin: 30px 0 0; display: grid; gap: 8px; position: sticky; top: 150px; }
.m-kit-figure figcaption { font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: center; }
.m-kit-preview { aspect-ratio: 4 / 5; border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  padding: 16px; color: #fff; background: radial-gradient(120% 80% at 70% 10%, #3a3f4b 0%, #16181d 60%, #0b0c0f 100%);
  box-shadow: var(--shadow-art); }
.m-kit-top img { display: block; max-width: 72px; max-height: 40px; object-fit: contain; }
.m-kit-mono { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--brand); color: #000;
  font-size: 13px; font-weight: 700; }
.m-kit-copy { display: grid; gap: 7px; }
.m-kit-line { height: 9px; border-radius: 3px; background: rgba(255, 255, 255, .88); }
.m-kit-line.w80 { width: 86%; } .m-kit-line.w60 { width: 62%; }
.m-kit-handle { margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--brand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-drop { transition: background .15s ease, box-shadow .15s ease; }
.m-drop.over { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.m-drop .m-text small { white-space: normal; }
.m-logo.empty { color: var(--muted); }
.m-swatch { background: var(--c, transparent); }
.m-swatch.unset { box-shadow: inset 0 0 0 1.5px var(--faint); background: repeating-conic-gradient(var(--fill-soft) 0 25%, transparent 0 50%) 0 0 / 10px 10px; }
.m-swatch input { opacity: 0; }
.m-presets { display: flex; flex-wrap: wrap; gap: 10px; }
.m-preset { width: 28px; height: 28px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; background: var(--c);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 16%, transparent); transition: transform .12s ease; }
.m-preset:hover { transform: scale(1.1); }
.m-preset[aria-pressed=true] { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--c); }

/* Status */
.m-state { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--warn);
  background: color-mix(in srgb, var(--warn) 14%, transparent); }
.m-state.idle { color: var(--muted); background: var(--fill-soft); }
.m-state.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.m-state .ico svg { width: 14px; height: 14px; stroke-width: 2.6; }

@media (max-width: 760px) {
  .m-template { grid-template-columns: 1fr; justify-items: center; text-align: left; }
  .m-template-art { max-width: 240px; }
  .m-kit { grid-template-columns: 1fr; }
  .m-kit-figure { position: static; margin: 0; max-width: 220px; justify-self: center; order: -1; }
  .m-cat-subs { padding-left: 18px; }
}

.m-sk-lead { width: 36px; height: 36px; border-radius: 10px; flex: none; }
.m-row .m-text .sk-line { height: 11px; margin: 3px 0; }

@media (max-width: 860px) { .m-bar { top: 80px; } }
@media (max-width: 640px) {
  .m-row { gap: 12px; padding: 10px 14px; }
  .m-pad { padding: 14px; }
  .m-field { padding: 12px 14px; }
  .m-follow, .m-logo-row { flex-wrap: wrap; }
  .m-follow .m-trail { flex-basis: 100%; padding-left: 36px; }
  .m-logo-row .m-trail { flex-basis: 100%; padding-left: 70px; }
  .m-follow .m-select { flex: 1; max-width: none; }
  .m-form .m-row { flex-wrap: wrap; gap: 6px; }
  .m-form .m-trail.grow { flex-basis: 100%; }
  .m-form .m-inline-input, .m-form .m-select { max-width: none; width: 100%; }
  .m-bar { flex-wrap: wrap; gap: 4px; }
  .m-tabs-wrap { flex-basis: 100%; }
  .m-savebar { bottom: 12px; }
  .m-template-editor-head { padding: 0 10px 0 14px; gap: 8px; }
  .m-template-editor-head .hint { display: none; }
}

/* ---------- Drafts: compact list ---------- */
.drafts-only #draft-search { flex: 1 1 220px; min-width: 160px; max-width: 320px; background: var(--fill-soft); border: 1px solid transparent;
  border-radius: 11px; padding: 9px 12px; color: var(--text); font: inherit; font-size: 15px; }
.drafts-only #draft-search:focus { outline: none; border-color: var(--accent); }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--fill-soft); }
.segmented .seg { border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.segmented .seg:hover { color: var(--text); }
.segmented .seg[aria-pressed="true"] { background: var(--raised); color: var(--text); box-shadow: var(--shadow-control); }
.seg-count { font-size: 12px; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
.seg[aria-pressed="true"] .seg-count { color: var(--muted); }

#drafts { display: grid; gap: 8px; }
.draft-row { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center; padding: 12px; border-radius: 16px;
  background: var(--card); cursor: pointer; transition: background .15s ease; outline: none; }
.draft-row:hover { background: var(--card-hover); }
.draft-row:focus-visible, .draft-row.focus { box-shadow: 0 0 0 2px var(--accent); }
.draft-row.skeleton-row { cursor: default; }
.draft-row.skeleton-row:hover { background: var(--card); }
.draft-thumb { width: 72px; aspect-ratio: 4 / 5; border-radius: 10px; overflow: hidden; background: var(--raised);
  display: grid; place-items: center; color: var(--faint); font-size: 11px; text-align: center; padding: 0; }
.draft-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.draft-thumb.sk { padding: 0; }
.draft-row-main { display: grid; gap: 5px; min-width: 0; }
.draft-row-main .sk-line { height: 12px; }
.draft-row-title { margin: 0; font-weight: 600; font-size: 16px; letter-spacing: -.01em; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.draft-row-caption { margin: 0; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.draft-row-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 2px; }
.draft-row-meta .state { font-size: 12px; padding: 2px 8px; }
.draft-row-source { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Draft studio: editor left, details right ---------- */
body.studio-open { overflow: hidden; }
/* Covers the main area only: the SocialShadow sidebar (264px) stays visible and usable. */
.studio { position: fixed; inset: 0 0 0 264px; z-index: 40; display: flex; flex-direction: column; background: var(--bg); }
@media (max-width: 860px) { .studio { left: 0; } }
.studio[hidden] { display: none; }
.studio-bar { display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 14px; flex: none;
  border-bottom: 1px solid var(--line); background: var(--bg); }
.studio-title { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px; }
.studio-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 400px; }
.studio-editor { position: relative; min-width: 0; min-height: 0; background: var(--editor-bg); }
.studio-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.studio-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px;
  color: var(--muted); text-align: center; padding: 24px; }
.studio-empty p { margin: 0; max-width: 360px; }
.studio-panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  border-left: 1px solid var(--line); background: var(--bg); }
.studio-hint { margin: 0; }
.studio-actions { padding-top: 4px; }
.btn.danger { color: var(--danger); }
@media (max-width: 960px) {
  .studio-body { grid-template-columns: 1fr; grid-template-rows: minmax(420px, 68vh) auto; overflow-y: auto; }
  .studio-panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .insp-body { overflow: visible; }
  #studio-panel .pv-foot { position: sticky; bottom: 0; z-index: 2; }
}

/* Headline dropdown (studio panel) and its floating options list */
.hl-field { display: grid; gap: 6px; }
.hl-select { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 1px solid var(--accent); background: var(--accent-soft); color: var(--text); font: inherit; font-size: 15.5px;
  font-weight: 600; line-height: 1.32; padding: 11px 12px 11px 14px; border-radius: 12px; cursor: pointer; }
.hl-select:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.hl-select[aria-expanded="true"] { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.hl-count { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.hl-chev svg { width: 12px; height: 12px; display: block; fill: none; stroke: currentColor; stroke-width: 2.2; opacity: .75; }
.hl-select[aria-expanded="true"] .hl-chev svg { transform: rotate(180deg); }
.float-panel { position: fixed; z-index: 60; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-pop); overflow: hidden; animation: float-in .14s ease-out; }
@keyframes float-in { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .float-panel { animation: none; } }
.float-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 6px 16px;
  font-size: 13px; font-weight: 600; color: var(--muted); flex: none; }
.float-close { border: 0; background: var(--fill-soft); color: var(--muted); width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; font-size: 12px; line-height: 1; }
.float-close:hover { background: var(--fill); color: var(--text); }
.float-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px 12px; border-top: 1px solid var(--line); flex: none; }
.hl-menu ul { list-style: none; margin: 0; padding: 4px 8px; overflow-y: auto; display: grid; gap: 2px; }
.hl-menu li button { width: 100%; text-align: left; border: 0; background: none; color: var(--text); font: inherit; font-size: 15px;
  font-weight: 500; line-height: 1.35; padding: 10px 12px 10px 34px; border-radius: 10px; cursor: pointer; position: relative; }
.hl-menu li button:hover, .hl-menu li button:focus-visible { background: var(--fill-soft); outline: none; }
.hl-menu li button.active { font-weight: 600; }
.hl-menu li button.active::before { content: ""; position: absolute; left: 13px; top: 15px; width: 10px; height: 6px;
  border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
/* Caption: preview in the panel, full text / options / editor in the floating panel */
.caption-preview { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; cursor: text; }
.link-btn { justify-self: start; border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-size: 14px;
  font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.cap-body { overflow-y: auto; padding: 4px 16px 14px; display: grid; gap: 16px; min-height: 0; flex: 1; }
.cap-full { margin: 0; white-space: pre-line; font-size: 15.5px; line-height: 1.55; color: var(--text); cursor: text; }
.cap-others { display: grid; gap: 8px; }
.cap-area { width: 100%; min-height: 300px; height: 100%; resize: none; background: var(--fill-soft); border: 1px solid var(--accent);
  border-radius: 12px; padding: 12px 14px; color: var(--text); font: inherit; font-size: 15.5px; line-height: 1.55; outline: none; }
.cap-hint, .cap-count { font-size: 12px; color: var(--faint); }
.cap-count { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---------- Studio inspector (right panel) ----------
   Hierarchy: the headline is the hero (large type), the caption reads as body copy,
   the source is a quiet reference card, and the one primary action lives in the footer. */
.insp-body { flex: 1; min-height: 0; overflow-y: auto; }
.insp-section { padding: 20px 22px; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.insp-section:last-child { border-bottom: 0; }
.insp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.insp-label { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: -.003em; }
.insp-meta { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

.insp-headline { display: grid; gap: 10px; width: 100%; padding: 0; border: 0; background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer; border-radius: 12px; }
.insp-headline-text { display: block; margin: 0; font-size: 21px; font-weight: 600; line-height: 1.26; letter-spacing: -.019em;
  color: var(--text); text-wrap: pretty; transition: color .15s ease; }
.insp-more { display: inline-flex; align-items: center; gap: 2px; padding: 3px 6px 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--muted); background: var(--fill-soft); transition: background .15s ease, color .15s ease; }
.insp-more .ico svg { width: 15px; height: 15px; transition: transform .18s ease; }
.insp-headline:hover .insp-more, .insp-headline[aria-expanded="true"] .insp-more,
.insp-block:hover .insp-more, .insp-block[aria-expanded="true"] .insp-more { color: var(--text); background: var(--fill); }
.insp-headline[aria-expanded="true"] .insp-more .ico svg, .insp-block[aria-expanded="true"] .insp-more .ico svg { transform: rotate(180deg); }
.insp-headline:focus-visible, .insp-block:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
/* Caption block: same behaviour as the headline block (click opens the side panel) */
.insp-block { display: grid; gap: 12px; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit;
  text-align: left; cursor: pointer; border-radius: 12px; }
.insp-block .insp-caption { margin: 0; cursor: pointer; transition: color .15s ease; }
.insp-block:hover .insp-caption { color: var(--text); }
.insp-block + .insp-tools { margin-top: 12px; }

.insp-caption { margin: 12px 0 14px; font-size: 15px; line-height: 1.6; color: color-mix(in srgb, var(--text) 86%, transparent);
  white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; cursor: text; }
.insp-tools { display: flex; align-items: center; gap: 2px; margin-left: -8px; }
.tool { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; min-width: 32px; padding: 0 9px;
  border: 0; border-radius: 9px; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: background .15s ease, color .15s ease; }
.tool:hover, .tool:focus-visible { background: var(--fill-soft); color: var(--text); outline: none; }
.tool:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.tool.danger:hover, .tool.danger:focus-visible { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.tool:disabled { opacity: .5; cursor: default; }
.ico { display: inline-flex; }
.ico svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.insp-link { margin-left: auto; border: 0; background: none; padding: 6px 2px; color: var(--accent); font: inherit;
  font-size: 14px; font-weight: 600; cursor: pointer; }
.insp-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.insp-source { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: start; margin-top: 12px;
  padding: 12px 10px 12px 12px; border-radius: 14px; background: var(--card); }
.insp-source .avatar { width: 36px; height: 36px; font-size: 13px; }
.insp-source-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14.5px; }
.insp-source-name b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insp-source p { margin: 3px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.insp-foot { display: flex; align-items: center; gap: 4px; padding: 14px 16px 14px 22px; flex: none;
  border-top: 1px solid var(--line); background: var(--bg); }
.insp-spacer { flex: 1; }
.insp-status { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.35; }
.insp-primary { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 11px;
  font-size: 15px; text-decoration: none; }
.insp-primary .ico svg { width: 18px; height: 18px; stroke-width: 2; }

/* Caption options list: same row style as the headline list, full text */
.cap-list { list-style: none; margin: 0; padding: 4px 8px; overflow-y: auto; display: grid; gap: 2px; min-height: 0; flex: 1; }
.cap-list li button { width: 100%; text-align: left; border: 0; background: none; color: color-mix(in srgb, var(--text) 82%, transparent);
  font: inherit; font-size: 15px; line-height: 1.55; padding: 12px 14px 12px 36px; border-radius: 10px; cursor: pointer;
  position: relative; white-space: pre-line; }
.cap-list li button:hover, .cap-list li button:focus-visible { background: var(--fill-soft); color: var(--text); outline: none; }
.cap-list li button.active { color: var(--text); cursor: text; }
.cap-list li button.active::before { content: ""; position: absolute; left: 14px; top: 19px; width: 10px; height: 6px;
  border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
.cap-list li + li { border-top: 1px solid color-mix(in srgb, var(--line) 45%, transparent); }
.cap-empty { margin: 0; padding: 8px 16px 16px; color: var(--muted); }

/* ---------- Studio: main actions (in the panel body, under Source) ---------- */
.insp-actions { display: grid; gap: 12px; }
.insp-publish { display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: 100%; height: 46px;
  border-radius: 12px; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.insp-publish .ico svg { width: 18px; height: 18px; stroke-width: 2; }
.insp-publish:disabled { opacity: .45; cursor: not-allowed; }
.insp-actions-row { display: flex; align-items: center; gap: 4px; }
.insp-secondary { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px;
  font-size: 14.5px; font-weight: 600; text-decoration: none; }
.insp-secondary .ico svg { width: 17px; height: 17px; }
.insp-schedule { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 14px;
  border-radius: 14px; background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.insp-schedule.failed { background: color-mix(in srgb, var(--danger) 12%, var(--card)); }
.insp-schedule-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, transparent); grid-row: span 2; }
.insp-schedule.failed .insp-schedule-icon { color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, transparent); }
.insp-schedule-icon .ico svg { width: 20px; height: 20px; }
.insp-schedule-main { display: grid; gap: 2px; min-width: 0; }
.insp-schedule-main b { font-size: 15px; font-weight: 600; }
.insp-schedule-main span { font-size: 14px; color: var(--muted); }
.insp-schedule-tools { grid-column: 2; display: flex; gap: 2px; margin-left: -9px; }

/* ---------- Publish dialog (Facebook-style scheduling options) ---------- */
.pub-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px;
  background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: pub-fade .15s ease-out; }
.pub-card { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-pop); overflow: hidden; animation: pub-rise .18s ease-out; }
@keyframes pub-fade { from { opacity: 0; } }
@keyframes pub-rise { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { .pub-backdrop, .pub-card { animation: none; } }
.pub-head { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; padding: 14px 14px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.pub-head h2 { grid-column: 2; margin: 0; text-align: center; font-size: 18px; font-weight: 700; letter-spacing: -.015em; }
.pub-head .float-close { grid-column: 3; justify-self: end; width: 34px; height: 34px; font-size: 13px; }
.pub-back { grid-column: 1; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--fill-soft); color: var(--text);
  display: grid; place-items: center; cursor: pointer; }
.pub-back:hover { background: var(--fill); }
.pub-back .ico svg { width: 18px; height: 18px; stroke-width: 2; }
.pub-preview { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: center; padding: 16px 18px 6px; }
.pub-thumb { width: 64px; aspect-ratio: 4 / 5; border-radius: 10px; overflow: hidden; background: var(--raised); }
.pub-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pub-preview-main { display: grid; gap: 8px; min-width: 0; }
.pub-preview-main p { margin: 0; font-size: 15.5px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pub-platform { width: 16px; height: 16px; border-radius: 50%; margin-left: 2px; }
.pub-option { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; width: calc(100% - 20px);
  margin: 10px; padding: 10px 12px 10px 10px; border: 0; border-radius: 14px; background: none; color: var(--text); font: inherit;
  text-align: left; cursor: pointer; }
.pub-option:hover, .pub-option:focus-visible { background: var(--fill-soft); outline: none; }
.pub-option-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--fill-soft); }
.pub-option-icon .ico svg { width: 22px; height: 22px; }
.pub-option-main { display: grid; gap: 2px; }
.pub-option-main b { font-size: 16px; font-weight: 600; }
.pub-option-main span { font-size: 14.5px; color: var(--muted); }
.pub-option > .ico svg { width: 20px; height: 20px; color: var(--muted); }
.pub-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 18px 18px; }
.pub-foot.stack { grid-template-columns: 1fr; }
.pub-foot .btn { height: 44px; border-radius: 11px; font-size: 15.5px; font-weight: 600; }
.pub-text { margin: 16px 18px 12px; font-size: 15px; line-height: 1.45; color: var(--text); }
.pub-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 18px; }
.pub-field { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 13px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.pub-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.pub-field .ico svg { width: 22px; height: 22px; color: var(--muted); }
.pub-field > span { display: grid; gap: 2px; min-width: 0; }
.pub-field small { font-size: 12.5px; color: var(--muted); }
.pub-field input { border: 0; background: none; padding: 0; color: var(--text); font: inherit; font-size: 16px; font-weight: 500;
  outline: none; width: 100%; }
.pub-error { margin: 8px 18px 0; min-height: 1.2em; font-size: 13.5px; color: var(--danger); }
.pub-error:empty { margin-top: 0; min-height: 0; }
.pub-fields + .pub-error + .pub-foot { padding-top: 14px; }

/* ---------- Scheduler tab ---------- */
.sched-list { display: grid; gap: 8px; max-width: 860px; }
.sched-note { margin: 0 0 6px; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.45; color: var(--muted);
  background: var(--card); }
.sched-day { margin: 18px 0 4px; font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: -.005em; }
.sched-day:first-child, .sched-note + .sched-day { margin-top: 4px; }
.sched-row { display: grid; grid-template-columns: 92px 58px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 12px;
  border-radius: 16px; background: var(--card); cursor: pointer; transition: background .15s ease; outline: none; }
.sched-row:hover { background: var(--card-hover); }
.sched-row:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.sched-row .draft-thumb { width: 58px; }
.sched-time { font-size: 17px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.sched-actions { display: flex; gap: 2px; }
.sched-state { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.sched-state.scheduled { color: var(--accent); background: var(--accent-soft); }
.sched-state.due, .sched-state.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.sched-state.failed { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.sched-state.published { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
@media (max-width: 640px) {
  .sched-row { grid-template-columns: 52px 1fr; }
  .sched-row .draft-thumb { display: none; }
  .sched-actions { grid-column: 2; margin-left: -9px; }
}

/* Confirmation bubble above the control that was used */
.action-tip { position: fixed; z-index: 90; padding: 6px 11px; border-radius: 9px; font-size: 13px; font-weight: 600;
  color: #fff; background: #2C2C2E; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); pointer-events: none; white-space: nowrap;
  opacity: 0; transform: translateY(4px); transition: opacity .16s ease, transform .16s ease; }
.action-tip::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; margin-left: -5px;
  background: inherit; transform: rotate(45deg); border-radius: 2px; }
.action-tip.show { opacity: 1; transform: none; }
.action-tip.has-action { pointer-events: auto; display: inline-flex; align-items: center; gap: 4px; padding: 6px 6px 6px 11px; }
.action-tip-link { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; padding: 2px 6px;
  border-radius: 6px; cursor: pointer; }
.action-tip-link:hover { background: rgba(255, 255, 255, .08); }
.action-tip.ok::before { content: ""; display: inline-block; width: 9px; height: 5px; margin: 0 7px 2px 0; vertical-align: middle;
  border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }
.action-tip.error { background: color-mix(in srgb, var(--danger) 85%, #000); }
:root[data-theme="light"] .action-tip { background: #1D1D1F; }
@media (prefers-reduced-motion: reduce) { .action-tip { transition: none; } }
/* AI remix in progress: the sparkle pulses, the label says Remixing… */
.tool.busy { color: var(--text); background: var(--fill-soft); cursor: progress; }
.tool.busy .ico svg { animation: remix-pulse 1s ease-in-out infinite; }
@keyframes remix-pulse { 50% { opacity: .35; transform: scale(.85); } }
@media (prefers-reduced-motion: reduce) { .tool.busy .ico svg { animation: none; } }

/* ---------- Drafts list: Preview / Publish on each row ---------- */
.row-actions { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.row-actions .tool { height: 30px; font-size: 13.5px; }
.row-preview[aria-pressed="true"] { color: var(--text); background: var(--fill); }
.row-publish { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.row-publish .ico svg { width: 15px; height: 15px; stroke-width: 2; }
.row-publish:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.row-publish:disabled { background: var(--fill-soft); color: var(--faint); cursor: not-allowed; }
.row-publish.scheduled { background: var(--accent-soft); color: var(--accent); }
.row-publish.scheduled:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.draft-row.previewing { background: var(--card-hover); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 70%, transparent); }

/* ---------- Draft preview: side panel beside the list ---------- */
:root { --pv-w: clamp(360px, calc(100vw - 264px - 800px - 24px), 460px); }
.draft-preview { position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; width: var(--pv-w); display: flex; flex-direction: column;
  background: var(--bg); border-left: 1px solid var(--line); animation: pv-in .18s ease-out; }
.draft-preview[hidden] { display: none; }
@keyframes pv-in { from { opacity: 0; transform: translateX(12px); } }
@media (prefers-reduced-motion: reduce) { .draft-preview { animation: none; } }
body.preview-open .main { max-width: min(800px, calc(100vw - 264px - var(--pv-w))); }
.pv-head { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 14px 0 20px; flex: none;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); font-size: 14px; }
.pv-head .btn { display: inline-flex; align-items: center; gap: 6px; }
.pv-head .btn .ico svg { width: 15px; height: 15px; }
.pv-head .float-close { width: 30px; height: 30px; }
.pv-poster-wrap { padding-top: 18px; }
.pv-poster { position: relative; aspect-ratio: 4 / 5; border-radius: 14px; overflow: hidden; background: var(--raised); cursor: pointer; }
.pv-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-tag { position: absolute; top: 10px; left: 10px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: #fff; background: rgba(0, 0, 0, .6); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.pv-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 20px;
  text-align: center; color: var(--muted); font-size: 14px; }
.pv-empty p { margin: 0; }
@media (max-width: 960px) {
  .draft-preview { left: 0; width: auto; z-index: 45; }
  body.preview-open .main { max-width: 800px; }
}
.pv-head .brand-pill, .pv-head .state, .studio-title .brand-pill, .studio-title .state { white-space: nowrap; }
.pv-head .brand-pill { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pv-tag.final::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px;
  background: var(--ok); vertical-align: 1px; }
.pv-caption { margin: 12px 0 10px; font-size: 15px; line-height: 1.6; white-space: pre-line;
  color: color-mix(in srgb, var(--text) 86%, transparent); }

/* Preview fits one screen: the poster takes the height that's left, the caption is a short
   preview, and the actions bar is always visible at the bottom. */
#draft-preview .insp-body { display: flex; flex-direction: column; overflow: hidden; }
/* As tall as the poster at full panel width (4:5, plus padding), shrinking when the window is short. */
#draft-preview .pv-poster-wrap { flex: 0 1 auto; height: calc((var(--pv-w) - 40px) * 5 / 4 + 30px); min-height: 220px;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 16px 20px 14px; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
#draft-preview .pv-poster-wrap { container-type: size; }
/* The largest 4:5 box that fits both the width and the height that's left (never cropped). */
#draft-preview .pv-poster { width: min(100cqw, 100cqh * 4 / 5); height: auto; aspect-ratio: 4 / 5; flex: none; }
#draft-preview .insp-section:not(.pv-poster-wrap) { flex: none; padding: 14px 20px 12px; }
#draft-preview .insp-caption { -webkit-line-clamp: 3; font-size: 14.5px; line-height: 1.5; }
#draft-preview .insp-block { gap: 8px; }
#draft-preview .insp-block + .insp-tools { margin-top: 6px; }
.pv-foot { flex: none; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 12px 14px 14px 20px;
  border-top: 1px solid var(--line); background: var(--bg); }
.pv-publish { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px;
  border-radius: 11px; font-size: 15px; font-weight: 600; margin-right: 6px; }
.pv-publish .ico svg { width: 17px; height: 17px; stroke-width: 2; }
.pv-publish.scheduled { background: var(--accent-soft); color: var(--accent); }
.pv-foot .tool { width: 40px; height: 40px; padding: 0; }
.pv-foot .tool .ico svg { width: 19px; height: 19px; }
.pv-foot .insp-schedule { flex-basis: 100%; margin-bottom: 6px; }
.pv-foot .insp-schedule .tool { width: auto; height: 32px; padding: 0 9px; }
#studio-panel .pv-foot { padding: 14px 14px 16px 20px; }
.pv-hint { flex-basis: 100%; margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
@media (max-height: 640px) { #draft-preview .insp-body { overflow-y: auto; } #draft-preview .pv-poster-wrap { flex: none; height: 320px; } }

/* ---------- Drafts list, inspector language ----------
   Groups by what to do next; each group is one surface with hairline-separated rows.
   Hierarchy per row: poster, headline (lead), caption, then quiet meta; one primary action. */
#drafts { display: grid; gap: 26px; }
.draft-group-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px 2px; font-size: 15px; font-weight: 600;
  letter-spacing: -.008em; color: var(--text); }
.draft-group-count { font-size: 13px; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
.draft-group-list { background: var(--card); border-radius: 18px; overflow: hidden; }
#drafts .draft-row { grid-template-columns: 84px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 16px 18px;
  border-radius: 0; background: none; box-shadow: none; }
#drafts .draft-row + .draft-row { border-top: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
#drafts .draft-row:hover { background: var(--card-hover); }
#drafts .draft-row:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
#drafts .draft-row.previewing { background: color-mix(in srgb, var(--accent) 9%, var(--card)); }
#drafts .draft-thumb { width: 84px; border-radius: 10px; }
#drafts .draft-row-main { gap: 4px; }
#drafts .draft-row-title { font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: -.015em; }
#drafts .draft-row-caption { font-size: 14.5px; color: var(--muted); }
#drafts .draft-row-meta { margin-top: 6px; gap: 14px; font-size: 13px; color: var(--muted); }
.row-brand { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-weight: 600; }
.row-brand .brand-avatar { width: 20px; height: 20px; border-radius: 6px; font-size: 10px; }
.row-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.row-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.row-status.poster_ready { color: var(--ok); }
.row-status.review { color: var(--accent); }
.row-status.processing { color: var(--warn); }
.row-status.failed { color: var(--danger); }
.row-status.skipped { color: var(--faint); }
#drafts .row-actions { margin-left: 0; gap: 4px; }
#drafts .row-actions .tool { height: 34px; font-size: 14px; color: var(--muted); }
#drafts .row-actions .tool:hover { color: var(--text); }
#drafts .row-publish { height: 34px; padding: 0 14px; font-size: 14px; }
#drafts .row-publish:disabled { background: none; color: var(--faint); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 80%, transparent); }
#drafts .skeleton-row { cursor: default; }
@media (max-width: 720px) {
  #drafts .draft-row { grid-template-columns: 64px minmax(0, 1fr); }
  #drafts .draft-thumb { width: 64px; }
  #drafts .row-actions { grid-column: 2; }
}
