:root {
  --bg: #f6f4ef; --surface: #ffffff; --surface-2: #f0ede6; --ink: #1d1c1a; --muted: #6b675f; --line: #e2ded5;
  --accent: #1f5c4d; --accent-ink: #ffffff; --accent-soft: #e3efe9;
  --info: #2a5db0; --info-soft: #e6eefb; --success: #1d7a46; --success-soft: #e2f3e8;
  --danger: #b3261e; --danger-soft: #fbe9e7; --demo: #6a3fb5; --demo-soft: #efe8fa; --warn: #8a5a00; --warn-soft: #fbf1dc;
  --radius: 12px; --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 4%);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514; --surface: #1e1e1c; --surface-2: #272724; --ink: #ecebe6; --muted: #a29e95; --line: #34332f;
    --accent: #6cc3a6; --accent-ink: #0e1f1a; --accent-soft: #1d322b;
    --info: #8ab4f8; --info-soft: #1d2a40; --success: #6fcf97; --success-soft: #19301f;
    --danger: #f28b82; --danger-soft: #3b1f1d; --demo: #c3a6f5; --demo-soft: #2b2140; --warn: #f2c46d; --warn-soft: #3a2e14;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .3em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: .3em 0; }
.muted { color: var(--muted); }
.help { color: var(--muted); font-size: .85rem; margin: .25rem 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spacer, .grow { flex: 1; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .6rem; }
.stack > * + * { margin-top: .8rem; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1.5rem; padding: .7rem 1.5rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: var(--accent); box-shadow: inset 0 0 0 6px var(--accent), inset 0 0 0 9px var(--accent-ink); }
.nav { display: flex; gap: .25rem; }
.nav a { padding: .35rem .7rem; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current] { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.demo-flag.live { color: var(--danger); background: var(--danger-soft); }
.badge-live { display: inline-block; margin-left: .4rem; font-size: .72rem; font-weight: 700; color: var(--success); background: var(--success-soft); padding: .05rem .45rem; border-radius: 999px; }
.demo-flag { margin-left: auto; font-size: .78rem; font-weight: 600; color: var(--demo); background: var(--demo-soft); padding: .25rem .6rem; border-radius: 999px; }
.view { max-width: 1320px; margin: 0 auto; padding: 1.5rem; outline: none; }
.page-head { display: flex; align-items: flex-end; gap: 1rem; justify-content: space-between; margin-bottom: 1.2rem; }

/* Buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .85rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-quiet { background: transparent; }
.btn-danger-quiet { background: transparent; border-color: transparent; color: var(--danger); }
input[type=text], input[type=url], input[type=email], input[type=password], input[type=datetime-local], textarea, select {
  width: 100%; padding: .5rem .6rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit;
}
input[type=datetime-local] { width: auto; }
textarea { resize: vertical; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Pills, dots, platform marks */
.pill { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill-neutral { background: var(--surface-2); color: var(--muted); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-demo { background: var(--demo-soft); color: var(--demo); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot-info { background: var(--info); } .dot-success { background: var(--success); } .dot-danger { background: var(--danger); } .dot-demo { background: var(--demo); } .dot-neutral { background: var(--line); box-shadow: inset 0 0 0 1px var(--muted); }
.pmark { --pc: #555; display: inline-grid; place-items: center; border-radius: 6px; background: var(--pc); color: #fff; font-weight: 800; letter-spacing: -.02em; flex: none; }
.pmark-xs { width: 14px; height: 14px; font-size: 6px; border-radius: 3px; }
.pmark-sm { width: 22px; height: 22px; font-size: 9px; }
.pmark-md { width: 28px; height: 28px; font-size: 11px; }
.pmark-lg { width: 40px; height: 40px; font-size: 14px; border-radius: 10px; }
[data-platform=youtube] { --pc: #d93025; } [data-platform=instagram] { --pc: #c13584; } [data-platform=facebook] { --pc: #1877f2; }
[data-platform=threads] { --pc: #2b2b2b; } [data-platform=linkedin] { --pc: #0a66c2; } [data-platform=pinterest] { --pc: #bd081c; }
[data-platform=tiktok] { --pc: #0f8f8a; } [data-platform=x] { --pc: #3a3f44; }
.badge-demo { display: inline-block; margin-left: .4rem; font-size: .72rem; font-weight: 700; color: var(--demo); background: var(--demo-soft); padding: .05rem .45rem; border-radius: 999px; }

/* Library */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: 1.6rem; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: center; color: var(--muted); }
.dropzone strong { color: var(--ink); font-size: 1.05rem; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.uploads { margin: .6rem 0; display: grid; gap: .4rem; }
.upload-row { display: flex; gap: .8rem; align-items: center; padding: .4rem .7rem; background: var(--surface); border-radius: 8px; font-size: .9rem; }
.upload-row progress { flex: 1; }
.upload-failed { border: 1px solid var(--danger); }
.error-text { color: var(--danger); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-top: 1rem; }
.card { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: transform .12s ease; }
.card:hover { transform: translateY(-2px); }
.card-visual { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.card-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.media-placeholder { display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.kind-badge { position: absolute; left: .5rem; bottom: .5rem; background: rgb(0 0 0 / 65%); color: #fff; font-size: .72rem; font-weight: 600; padding: .1rem .45rem; border-radius: 6px; }
.card-body { padding: .7rem .8rem .85rem; display: grid; gap: .35rem; }
.card-title { margin: 0; font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-summary { margin: 0; color: var(--muted); font-size: .82rem; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.dchip { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .3rem .1rem .1rem; border-radius: 8px; background: var(--surface-2); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); grid-column: 1 / -1; }
.empty.small { padding: 1.5rem; }

/* Fan-out */
.fanout { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 1.2rem; align-items: start; }
.original { position: sticky; top: 4.2rem; display: grid; gap: 1rem; max-height: calc(100vh - 5rem); overflow: auto; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.panel.narrow { max-width: 720px; margin-bottom: 1rem; }
.back { font-size: .85rem; text-decoration: none; }
.asset-title { font-size: 1.25rem; margin-top: .4rem; word-break: break-word; }
.player { width: 100%; max-height: 360px; border-radius: 8px; background: #000; display: block; margin-top: .6rem; object-fit: contain; }
.cover { margin-top: 1rem; }
.cover-thumb { position: relative; width: 100%; aspect-ratio: 16/9; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: grid; place-items: center; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
.section-head h3 { margin: 0; }
.field { display: grid; gap: .25rem; margin-top: .7rem; }
.field label { font-weight: 600; font-size: .88rem; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; }
.field-check { display: flex; align-items: center; gap: .5rem; grid-template-columns: none; }
.field-check label { font-weight: 500; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--danger); }
.req { color: var(--danger); }
.counter { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--danger); font-weight: 700; }
.fanout-main { display: grid; gap: 1rem; min-width: 0; }
.dests { display: flex; flex-wrap: wrap; gap: .45rem; }
.dest { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .7rem .35rem .4rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .88rem; cursor: pointer; }
.dest.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.dest.on::after { content: "✓"; color: var(--accent); font-weight: 800; }
.dest:disabled { opacity: .5; cursor: not-allowed; }
.bulk { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line); font-size: .9rem; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .7rem .4rem .4rem; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.tab[aria-selected=true] { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow); }
.err-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .7rem; display: inline-grid; place-items: center; }
.editor { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; }
.editor-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.editor-head h2 { margin: 0; }
.editor-head p { margin: 0; }
.save-state { font-size: .8rem; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.2rem; margin-top: .6rem; }
.issues ul { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .35rem; }
.issue { display: flex; gap: .5rem; align-items: baseline; font-size: .87rem; padding: .35rem .55rem; border-radius: 8px; }
.issue-level { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; min-width: 4.2rem; }
.issue-error { background: var(--danger-soft); color: var(--danger); }
.issue-warning { background: var(--warn-soft); color: var(--warn); }
.issue-info { background: var(--info-soft); color: var(--info); }
.ok-text { color: var(--success); font-weight: 600; margin-top: 1rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.editor-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-top: .8rem; font-size: .88rem; }
.history summary { cursor: pointer; color: var(--muted); }
.attempts { padding-left: 1.1rem; margin: .4rem 0; }
.banner { margin-top: .8rem; padding: .65rem .8rem; border-radius: 10px; font-size: .9rem; }
.banner-demo { background: var(--demo-soft); color: var(--demo); }
.banner-danger { background: var(--danger-soft); color: var(--danger); }
.banner-success { background: var(--success-soft); color: var(--success); }
.banner-info { background: var(--info-soft); color: var(--info); }

/* Previews */
.preview-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .35rem; }
.preview-frame { border: 1px solid var(--line); border-radius: 12px; padding: .7rem; background: var(--bg); display: grid; gap: .5rem; font-size: .86rem; }
.pv-who { display: flex; align-items: center; gap: .45rem; }
.pv-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--pc, var(--muted)); opacity: .8; }
.pv-media { position: relative; background: var(--surface-2); border-radius: 8px; overflow: hidden; display: grid; place-items: center; }
.pv-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pv-wide { aspect-ratio: 16 / 9; } .pv-portrait { aspect-ratio: 4 / 5; } .pv-tall { aspect-ratio: 9 / 16; width: min(100%, 236px); justify-self: center; }
.pv-play { position: absolute; width: 38px; height: 38px; border-radius: 50%; background: rgb(0 0 0 / 55%); color: #fff; display: grid; place-items: center; font-size: .9rem; }
.pv-noimg { color: var(--muted); font-size: .8rem; }
.pv-text { margin: 0; white-space: pre-wrap; word-break: break-word; }
.pv-clamp { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pv-tag { color: var(--info); }
.pv-more { color: var(--muted); }
.pv-yt-title { font-weight: 700; font-size: .95rem; }
.pv-meta { color: var(--muted); font-size: .78rem; }
.pv-tt { position: relative; }
.pv-tt-overlay { position: absolute; inset: auto 0 0 0; padding: .7rem; color: #fff; background: linear-gradient(transparent, rgb(0 0 0 / 75%)); border-radius: 0 0 8px 8px; }
.pv-tt-overlay p { margin: .2rem 0 0; white-space: pre-wrap; }
.pv-tt-overlay .pv-tag { color: #fff; font-weight: 700; }

/* Queue */
.strip { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: .3rem; margin-bottom: 1rem; }
.strip-day { background: var(--surface); border-radius: 8px; padding: .4rem .3rem; display: grid; justify-items: center; gap: .1rem; min-height: 72px; font-size: .75rem; }
.strip-day.busy { box-shadow: inset 0 0 0 2px var(--accent); }
.strip-dow { color: var(--muted); }
.strip-num { font-weight: 700; font-size: .95rem; }
.strip-marks { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.filters { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter { padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .85rem; cursor: pointer; }
.filter[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.qgroup { margin-bottom: 1.2rem; }
.qgroup h2 { font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.qrow { display: flex; align-items: center; gap: .8rem; padding: .6rem .8rem; background: var(--surface); border-radius: 10px; margin-bottom: .35rem; text-decoration: none; color: inherit; }
.qrow:hover { box-shadow: var(--shadow); }
.qrow-failed { box-shadow: inset 3px 0 0 var(--danger); }
.qtime { width: 4.6rem; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; }
.qmain { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 0 .2rem; align-items: baseline; }
.qerr { flex-basis: 100%; color: var(--danger); font-size: .82rem; }

/* Channels */
.platform-list { margin-top: 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 1rem; }
.platform-card { background: var(--surface); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.platform-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .6rem; }
.platform-head h2 { margin: 0; }
.platform-head p { margin: 0; font-size: .82rem; }
.channel-rows { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.channel-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.channel-row input { flex: 1; min-width: 140px; }
.channel-row select { width: auto; }
.inline { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; }
.reqs { margin-top: .8rem; font-size: .86rem; }
.reqs summary { cursor: pointer; font-weight: 600; }
.reqs dl { display: grid; grid-template-columns: 7rem 1fr; gap: .35rem .6rem; margin: .6rem 0 0; }
.reqs dt { color: var(--muted); }
.reqs dd { margin: 0; }
.reqs ul { margin: 0; padding-left: 1.1rem; }

/* Account + sign-in */
.account { display: inline-flex; align-items: center; gap: .5rem; font-size: .85rem; white-space: nowrap; }
.brand, .demo-flag, .account .btn { white-space: nowrap; }
.topbar { flex-wrap: wrap; row-gap: .5rem; }
.account[hidden], .nav[hidden], .demo-flag[hidden] { display: none; }
.auth-wrap { min-height: 70vh; display: grid; place-items: center; }
.auth-card { width: min(420px, 100%); display: grid; gap: .3rem; }
.auth-card h1 { font-size: 1.35rem; margin: .6rem 0 .2rem; }
.auth-card [hidden] { display: none; }
.team-list { list-style: none; padding: 0; margin: .5rem 0 1rem; display: grid; gap: .4rem; }
.team-list li { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .45rem 0; border-bottom: 1px solid var(--line, rgba(127,127,127,.2)); }
.team-list li > span:first-child { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.invite-link { margin-top: .5rem; flex-wrap: nowrap; }
.invite-link input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }
.ws-switch { min-width: 9rem; max-width: 14rem; font-size: .85rem; }
.account { flex-wrap: wrap; }
.link-button { justify-self: start; background: none; border: 0; padding: 0; color: var(--accent, inherit); font: inherit; font-size: .88rem; text-decoration: underline; cursor: pointer; }
.brand-mark.big { width: 36px; height: 36px; border-radius: 10px; box-shadow: inset 0 0 0 9px var(--accent), inset 0 0 0 13px var(--accent-ink); background: var(--accent); }

/* Confirm dialog */
.confirm-dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 1.1rem 1.2rem; max-width: min(440px, calc(100vw - 2rem)); box-shadow: var(--shadow); }
.confirm-dialog::backdrop { background: rgb(0 0 0 / 45%); }
.confirm-text { margin: 0; line-height: 1.5; }
.confirm-actions { justify-content: flex-end; margin-top: 1rem; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Toasts */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .4rem; z-index: 50; max-width: min(420px, calc(100vw - 2rem)); }
.toast { padding: .65rem .9rem; border-radius: 10px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); font-size: .9rem; }
.toast-error { background: var(--danger); color: #fff; }
.toast-success { background: var(--success); color: #fff; }

@media (max-width: 1100px) { .editor-grid { grid-template-columns: 1fr; } .preview-col { max-width: 360px; } }
@media (max-width: 860px) {
  .fanout { grid-template-columns: 1fr; }
  .original { position: static; max-height: none; }
  .topbar { flex-wrap: wrap; gap: .6rem; padding: .6rem 1rem; }
  .demo-flag { margin-left: 0; }
  .view { padding: 1rem; }
  .strip { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .platform-list { grid-template-columns: 1fr; }
}
