/* SocialCollab. Every color comes from these tokens; dark mode follows the device setting. */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --field: #ffffff;
  --ink: #1d2233;
  --muted: #5d6479;
  --line: #e2e5ef;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: #eceafe;
  --ok: #117a4b;
  --ok-soft: #e3f5ec;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --danger: #b42336;
  --danger-soft: #fdeaec;
  --info: #1d5fa8;
  --info-soft: #e5f0fc;
  --pin: #f43f5e;
  --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 4px 16px rgba(20, 24, 40, .06);
  --radius: 12px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e1017;
    --surface: #161924;
    --surface-2: #1d2130;
    --field: #11141d;
    --ink: #eceef5;
    --muted: #a0a6ba;
    --line: #2a2f41;
    --accent: #8b85ff;
    --accent-ink: #0e1017;
    --accent-soft: #25234a;
    --ok: #5fd39a;
    --ok-soft: #13301f;
    --warn: #f2c366;
    --warn-soft: #33280f;
    --danger: #ff8a98;
    --danger-soft: #3a161c;
    --info: #86b8f5;
    --info-soft: #14263d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
a { color: var(--accent); }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- chrome */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.company-switch select { font-weight: 600; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; }
.tabs {
  display: flex; gap: 4px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none; position: sticky; top: 53px; z-index: 19;
}
.tabs a {
  padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.container { max-width: 1240px; margin: 0 auto; padding: 24px 20px 64px; }

/* ---------------------------------------------------------------- building blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.page-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .spacer { min-width: 12px; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: 500 .92rem var(--font);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: none; }
.btn-outline { background: transparent; color: var(--accent); }
.btn-quiet { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: .82rem; }
.linklike { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }

label { display: block; font-weight: 500; font-size: .88rem; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--field);
  color: var(--ink); font: 400 .95rem var(--font);
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.field + .field { margin-top: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.chip.draft { background: var(--surface-2); color: var(--muted); }
.chip.in_review, .chip.publishing { background: var(--info-soft); color: var(--info); }
.chip.changes_requested, .chip.partial { background: var(--warn-soft); color: var(--warn); }
.chip.approved, .chip.scheduled { background: var(--accent-soft); color: var(--accent); }
.chip.published { background: var(--ok-soft); color: var(--ok); }
.chip.failed { background: var(--danger-soft); color: var(--danger); }
.net { display: inline-flex; width: 22px; height: 22px; border-radius: 6px; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; color: #fff; }
.net.instagram { background: linear-gradient(135deg, #f58529, #dd2a7b 50%, #8134af); }
.net.facebook { background: #1877f2; }
.net.tiktok { background: #111; box-shadow: inset 0 0 0 1px #444; }

.notice { padding: 10px 14px; border-radius: 8px; background: var(--info-soft); color: var(--info); font-size: .9rem; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }

/* ---------------------------------------------------------------- landing */
.hero { max-width: 760px; margin: 48px auto; text-align: center; }
.hero h1 { font-size: 2.2rem; }
.hero p { font-size: 1.1rem; color: var(--muted); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 36px; text-align: left; }

/* ---------------------------------------------------------------- campaigns and posts */
.campaign-card { display: block; color: inherit; text-decoration: none; }
.campaign-card:hover { border-color: var(--accent); }
.counts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.post-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.post-card:hover { border-color: var(--accent); }
.post-card .cover { aspect-ratio: 4 / 5; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); overflow: hidden; }
.post-card .cover img, .post-card .cover video { width: 100%; height: 100%; object-fit: cover; }
.post-card .body { padding: 12px 14px; }
.post-card .title { font-weight: 600; margin-bottom: 4px; }
.post-card .caption { color: var(--muted); font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* post editor */
.editor { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.viewer { position: relative; background: #0b0d14; border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 320px; }
.viewer .frame { position: relative; display: inline-block; max-width: 100%; }
.viewer img, .viewer video { display: block; max-width: 100%; max-height: 70vh; }
.viewer img { cursor: crosshair; }
.pin {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: var(--pin); color: #fff;
  font-size: .75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4); cursor: pointer; padding: 0;
}
.pin.resolved { background: #6b7280; }
.pin.draft { background: var(--accent); }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.thumb { position: relative; width: 84px; height: 84px; flex: 0 0 auto; border-radius: 8px; overflow: hidden; border: 2px solid transparent; background: var(--surface-2); cursor: pointer; padding: 0; }
.thumb.active { border-color: var(--accent); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.thumb .badge { position: absolute; left: 4px; bottom: 4px; background: rgba(0, 0, 0, .65); color: #fff; font-size: .7rem; padding: 0 5px; border-radius: 4px; }
.dropzone {
  width: 84px; height: 84px; flex: 0 0 auto; border: 2px dashed var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: .78rem; text-align: center; cursor: pointer; background: transparent;
}
.dropzone.over { border-color: var(--accent); color: var(--accent); }
.media-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: .85rem; }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.nets { display: flex; gap: 8px; flex-wrap: wrap; }
.net-toggle { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 500; }
.net-toggle.on { border-color: var(--accent); background: var(--accent-soft); }
.net-toggle input { margin: 0; }
.counter { font-size: .78rem; color: var(--muted); text-align: right; }
.counter .over { color: var(--danger); font-weight: 600; }
.problems { margin: 6px 0 0; padding-left: 18px; color: var(--danger); font-size: .85rem; }
details.section > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.results li { margin-bottom: 4px; }

.comments .comment { padding: 10px 0; border-top: 1px solid var(--line); }
.comments .comment:first-child { border-top: 0; }
.comment .meta { font-size: .8rem; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.comment .text { white-space: pre-wrap; margin: 4px 0; overflow-wrap: anywhere; }
.comment.resolved .text { color: var(--muted); }
.comment .replies { margin-left: 18px; border-left: 2px solid var(--line); padding-left: 12px; }
.comment .tag { font-size: .75rem; background: var(--surface-2); padding: 1px 7px; border-radius: 999px; cursor: pointer; border: 0; color: var(--ink); }
.comment.flash { background: var(--accent-soft); border-radius: 8px; }
.activity li { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .dow { padding: 8px; font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--surface-2); text-transform: uppercase; }
.cal .day { min-height: 110px; padding: 6px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal .day:nth-child(7n + 1) { border-left: 0; }
.cal .day.other { background: var(--surface-2); opacity: .6; }
.cal .day.today .num { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; }
.cal .num { font-size: .8rem; font-weight: 600; display: inline-block; margin-bottom: 4px; }
.cal .item { display: block; font-size: .76rem; padding: 3px 6px; border-radius: 6px; margin-bottom: 3px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* connections */
.conn-head { display: flex; align-items: center; gap: 12px; }
.conn-logo { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }

/* toast + dialog */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 50; max-width: calc(100% - 32px); }
.toast.error { background: var(--danger); color: #fff; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 20px; width: min(520px, calc(100% - 32px)); box-shadow: var(--shadow); }
dialog.wide { width: min(760px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(10, 12, 20, .45); }

@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .container { padding: 16px 16px 48px; }
  .topbar { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .tabs { padding: 0 8px; top: 0; position: static; }
  .two { grid-template-columns: 1fr; }
  #who-name { display: none; }
  .cal .day { min-height: 70px; padding: 3px; }
  .cal .item { font-size: .68rem; padding: 2px 3px; }
  .hero h1 { font-size: 1.7rem; }
}

/* footer, legal pages, setup checklist, connection problems */
.footer { max-width: 1240px; margin: 0 auto; padding: 0 20px 32px; color: var(--muted); font-size: .85rem; }
.footer a { color: var(--muted); }
.legal { max-width: 760px; }
.legal h2 { margin-top: 28px; }
.legal li { margin-bottom: 6px; }
.checklist { list-style: none; padding: 0; margin: 8px 0 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.checklist li:first-child { border-top: 0; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: .8rem; border: 2px solid var(--line); color: transparent; }
.checklist li.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.checklist li.done .what { color: var(--muted); text-decoration: line-through; }
.problem { border-left: 3px solid var(--danger); background: var(--danger-soft); padding: 8px 12px; border-radius: 6px; font-size: .9rem; }
.problem.warning { border-color: var(--warn); background: var(--warn-soft); }
.problem .fix { color: var(--ink); margin-top: 2px; }
.banner { max-width: 1240px; margin: 12px auto 0; padding: 0 20px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }

/* help link in the header, help page */
.help-link { margin-left: auto; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .92rem; }
.help-link:hover { color: var(--accent); }
.help-link + .who { margin-left: 12px; }
.help { max-width: 1160px; margin: 0 auto; padding: 24px 20px 48px; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; align-items: start; }
.help-toc { position: sticky; top: 76px; font-size: .9rem; }
.help-toc ol { list-style: none; padding: 0; margin: 8px 0 0; }
.help-toc li { margin: 0; }
.help-toc a { display: block; padding: 5px 10px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; }
.help-toc a:hover, .help-toc a.active { color: var(--accent); border-left-color: var(--accent); }
.help-body { max-width: 780px; }
.help-body section { padding-top: 12px; margin-top: 20px; border-top: 1px solid var(--line); scroll-margin-top: 70px; }
.help-body h2 { font-size: 1.35rem; margin-bottom: .6rem; }
.help-body h3 { margin-top: 1.1rem; }
.help-body li { margin-bottom: 6px; }
.help-body .lead { font-size: 1.08rem; color: var(--muted); }
.help-body table.list { margin: 8px 0 14px; font-size: .92rem; }
.help-quick ol { margin: 0; padding-left: 20px; }
.tip { background: var(--info-soft); color: var(--ink); border-left: 3px solid var(--info); padding: 10px 14px; border-radius: 6px; font-size: .92rem; }
.ok-text { color: var(--ok); font-weight: 600; }
.flow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 12px; color: var(--muted); }
.checks { padding-left: 20px; }
details.faq { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; background: var(--surface); }
details.faq summary { cursor: pointer; font-weight: 600; }
details.faq p { margin: 8px 0 0; }
@media (max-width: 860px) {
  .help { grid-template-columns: 1fr; gap: 12px; }
  .help-toc { position: static; }
  .help-toc ol { columns: 2; }
}

/* Library */
.pk-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
button.dropzone { background: var(--surface-2); border: 1px dashed var(--line); color: var(--muted); cursor: pointer; }
.lib-card { font: inherit; color: inherit; background: var(--surface); }
.lib-layout { display: grid; grid-template-columns: 210px 1fr; gap: 18px; align-items: start; }
.lib-folders { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 76px; }
.lib-folder { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; color: inherit; text-decoration: none; overflow: hidden; }
.lib-folder span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-folder:hover { background: var(--surface-2); }
.lib-folder.active { background: var(--accent-soft, var(--surface-2)); font-weight: 600; }
.lib-card.picked { outline: 3px solid var(--accent); }
.lib-check { position: absolute; top: 8px; left: 8px; font-size: 1.2rem; z-index: 1; }
@media (max-width: 760px) {
  .lib-layout { grid-template-columns: 1fr; }
  .lib-folders { flex-direction: row; overflow-x: auto; position: static; padding-bottom: 4px; }
  .lib-folder { flex: none; border: 1px solid var(--line); }
}

/* Photo editor + cover picker (web/editor.js) */
body.pe-open { overflow: hidden; }
.pe-shell { position: fixed; inset: 0; z-index: 1000; background: var(--surface); display: flex; flex-direction: column; }
.pe-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pe-host { flex: 1; min-height: 0; }
.pe-qr { position: fixed; z-index: 1001; top: 70px; left: 50%; transform: translateX(-50%); width: min(420px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.pe-cover { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 14px; align-items: stretch; }
.pe-cover video { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #000; border-radius: 10px; }
.pe-scrub { display: flex; gap: 10px; align-items: center; }
.pe-scrub input { flex: 1; }
.cover-badge { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: .7rem; border-radius: 6px; padding: 1px 6px; }
.cover-thumb { width: 36px; height: 48px; object-fit: cover; border-radius: 6px; }
.brand-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.brand-item { display: flex; flex-direction: column; gap: 6px; }
.brand-thumb { aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: repeating-conic-gradient(#e6e8f0 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.brand-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ov-row { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.cue-row { display: grid; grid-template-columns: 64px 64px 1fr auto; gap: 6px; align-items: center; }
.net.youtube { background: #c4302b; }
.net.linkedin, .net.linkedinprofile { background: #0a66c2; text-transform: lowercase; }
.fmt-row { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; border-top: 1px solid var(--line); }
.fmt-row:first-child { border-top: 0; }
.fmt-net { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 600; }
