:root {
  --bg: #f5f6f8; --panel: #ffffff; --panel-2: #f9fafb; --ink: #0f1419; --muted: #5b6670; --faint: #8b96a0; --line: #e4e7eb;
  --accent: #1d9bf0; --accent-strong: #0c7cc7; --accent-ink: #ffffff; --soft-acc: #e7f3fd;
  --ok: #12805c; --warn: #9a5b00; --bad: #c8312f;
  --soft-ok: #e3f5ee; --soft-warn: #fff3dc; --soft-bad: #fde8e7;
  --chip-draft: #eef0f3; --chip-sched: #fff1d6; --chip-pub: #dff3ea; --chip-fail: #fde4e2;
  --heat-lo: #cde2fb; --heat-hi: #0d366b; --heat-none: #eef0f3; --bar: #2a78d6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 14px; --side: 232px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f14; --panel: #12171e; --panel-2: #171d25; --ink: #e6edf3; --muted: #9aa5b1; --faint: #6e7a86; --line: #252d37;
    --accent-strong: #4cb3f5; --soft-acc: #0e2a3f; --soft-ok: #0f2e24; --soft-warn: #33270c; --soft-bad: #3a1514; --ok: #3fc08f; --warn: #f0b04a; --bad: #ff7b72;
    --chip-draft: #1f2630; --chip-sched: #3a2c0e; --chip-pub: #11372a; --chip-fail: #3f1a18;
    --heat-lo: #184f95; --heat-hi: #b7d3f6; --heat-none: #1b222b; --bar: #5598e7;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f14; --panel: #12171e; --panel-2: #171d25; --ink: #e6edf3; --muted: #9aa5b1; --faint: #6e7a86; --line: #252d37;
  --accent-strong: #4cb3f5; --soft-acc: #0e2a3f; --soft-ok: #0f2e24; --soft-warn: #33270c; --soft-bad: #3a1514; --ok: #3fc08f; --warn: #f0b04a; --bad: #ff7b72;
  --chip-draft: #1f2630; --chip-sched: #3a2c0e; --chip-pub: #11372a; --chip-fail: #3f1a18;
  --heat-lo: #184f95; --heat-hi: #b7d3f6; --heat-none: #1b222b; --bar: #5598e7;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14.5px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent-strong); text-decoration: none; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; background: var(--panel); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; padding: 4px 10px 16px; }
.logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #1d9bf0, #0c5fa3); color: #fff; font-weight: 800; flex: none; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.compose-btn { margin: 0 4px 12px; justify-content: center; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; position: relative; }
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.active { background: var(--soft-acc); color: var(--accent-strong); font-weight: 600; }
.nav .count { margin-left: auto; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 4px; align-items: flex-start; }
main { padding: 28px 32px 90px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
h2 { font-size: 15px; margin: 0 0 12px; }
h3 { font-size: 12px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.mobile-top { display: none; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.mobile-top .brand { padding: 0; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; z-index: 20; flex-direction: row; padding: 4px 6px; border-right: 0; border-top: 1px solid var(--line); }
  .side > .brand, .side-foot, .side .compose-btn { display: none; }
  .nav { display: flex; flex: 1; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 10.5px; }
  .nav a.hide-sm { display: none; }
  .nav .count { position: absolute; top: 0; right: 0; margin: 0; font-size: 10px; padding: 0 5px; }
  main { padding: 18px 16px 100px; }
  .mobile-top { display: flex; }
}

/* ---------- Building blocks ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.two { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
.halves { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .two, .halves { grid-template-columns: minmax(0, 1fr); } }
.kpi .l { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; letter-spacing: -.02em; }
.kpi .s { color: var(--faint); font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; }
.empty { color: var(--muted); text-align: center; padding: 28px 8px; }
.empty svg.i { width: 28px; height: 28px; display: block; margin: 0 auto 8px; color: var(--faint); }

.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 7px 14px; border-radius: 10px; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #0c7cc7; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg.i { width: 16px; height: 16px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; }
.icon-btn:hover { background: var(--panel-2); color: var(--ink); }
.icon-btn.on { color: var(--accent-strong); background: var(--soft-acc); }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--soft-acc); color: var(--accent-strong); white-space: nowrap; }
.pill.draft, .pill.neutral { background: var(--chip-draft); color: var(--muted); }
.pill.scheduled { background: var(--chip-sched); color: var(--warn); }
.pill.published, .pill.live { background: var(--chip-pub); color: var(--ok); }
.pill.failed, .pill.todo { background: var(--chip-fail); color: var(--bad); }
.pill.deleted { background: var(--chip-draft); color: var(--muted); text-decoration: line-through; }
.pill.dry { background: var(--soft-warn); color: var(--warn); }

textarea, input, select { width: 100%; font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type="checkbox"] { width: auto; }
label.f { display: block; font-size: 12.5px; color: var(--muted); margin: 14px 0 5px; font-weight: 600; }
.notice { background: var(--soft-warn); color: var(--warn); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; }
.notice.bad { background: var(--soft-bad); color: var(--bad); }
.notice.info { background: var(--soft-acc); color: var(--accent-strong); }

.tabs { display: flex; gap: 2px; flex-wrap: wrap; background: var(--panel-2); border: 1px solid var(--line); padding: 3px; border-radius: 11px; width: fit-content; max-width: 100%; }
.tabs button { border: 0; background: transparent; color: var(--muted); border-radius: 8px; padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-transform: capitalize; }
.tabs button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Post list ---------- */
.list { display: flex; flex-direction: column; }
.item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 4px 14px; padding: 12px 6px; border-top: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.item:first-child { border-top: 0; }
.item:hover { background: var(--panel-2); }
.item .thumb { grid-row: span 2; width: 48px; height: 48px; border-radius: 9px; object-fit: cover; background: var(--panel-2); display: grid; place-items: center; color: var(--faint); border: 1px solid var(--line); }
.item .text { white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .right { grid-row: span 2; display: flex; flex-wrap: wrap; justify-content: flex-end; align-content: flex-start; gap: 4px; max-width: 220px; }
.meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta svg.i { width: 14px; height: 14px; }
@media (max-width: 600px) { .item { grid-template-columns: 40px minmax(0, 1fr); } .item .thumb { width: 40px; height: 40px; } .item .right { grid-row: auto; grid-column: 2; justify-content: flex-start; max-width: none; } .item .meta { grid-column: 1 / -1; } }

/* ---------- Composer ---------- */
.part { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 6px; background: var(--panel); }
.part + .part { margin-top: 10px; }
.part textarea { border: 0; padding: 4px 0; min-height: 96px; resize: vertical; font-size: 15.5px; background: transparent; }
.part textarea:focus { outline: none; }
.part:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft-acc); }
.part-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.part-num { font-size: 11.5px; font-weight: 700; color: var(--faint); }
.counter { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 6px; }
.counter.over { color: var(--bad); font-weight: 700; }
.toolbar { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; padding: 6px 0 2px; }
.menu { position: relative; display: inline-block; }
.menu-pop { position: absolute; z-index: 30; top: 100%; left: 0; min-width: 250px; max-width: 320px; max-height: 330px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; display: none; }
.menu.open .menu-pop { display: block; }
.menu-pop > button { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--ink); font: inherit; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.menu-pop > button:hover { background: var(--panel-2); }
.menu-pop small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-pop .sep { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; padding: 6px 10px 2px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-grid button { text-align: center; font-size: 19px; padding: 4px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; }
.emoji-grid button:hover { background: var(--panel-2); }
.media-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.media-tile { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); }
.media-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.media-tile input { border: 0; border-top: 1px solid var(--line); border-radius: 0; font-size: 11.5px; padding: 5px 7px; }
.media-tile .x { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.65); color: #fff; border: 0; border-radius: 999px; width: 22px; height: 22px; cursor: pointer; line-height: 1; }
.drop { border: 1.5px dashed var(--line); border-radius: 12px; padding: 12px; text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--soft-acc); color: var(--accent-strong); }
.ai-panel { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: linear-gradient(180deg, var(--soft-acc), var(--panel) 80%); margin-top: 12px; }
.ai-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-option { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 8px; background: var(--panel); }
.ai-option .t { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 6px; }
.slot-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink); }
.slot-chip:hover, .slot-chip.on { border-color: var(--accent); color: var(--accent-strong); background: var(--soft-acc); }
details.more { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
details.more summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.sched-box { display: flex; flex-direction: column; gap: 10px; }
.sched-box .btn { justify-content: center; }

/* X-style preview */
.xprev { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px 2px; background: var(--panel); }
.xpost { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; position: relative; padding-bottom: 12px; }
.xpost .av { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #1d9bf0, #0c5fa3); color: #fff; display: grid; place-items: center; font-weight: 800; }
.xpost.has-next::before { content: ""; position: absolute; left: 19px; top: 46px; bottom: 0; width: 2px; background: var(--line); }
.xpost .who { font-size: 14px; } .xpost .who b { margin-right: 4px; } .xpost .who span { color: var(--muted); }
.xpost .body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; margin-top: 1px; }
.xpost .body .lnk, .xpost .body .tag { color: var(--accent-strong); }
.ximgs { display: grid; gap: 2px; border-radius: 14px; overflow: hidden; margin-top: 8px; border: 1px solid var(--line); grid-template-columns: 1fr 1fr; }
.ximgs.n1 { grid-template-columns: 1fr; }
.ximgs.n3 img:first-child { grid-row: span 2; height: 100%; }
.ximgs img { width: 100%; height: 130px; object-fit: cover; display: block; }
.ximgs.n1 img { height: 220px; }
.xactions { display: flex; justify-content: space-between; color: var(--faint); font-size: 12px; margin-top: 8px; max-width: 300px; }
.xactions span { display: inline-flex; align-items: center; gap: 4px; }
.xactions svg.i { width: 15px; height: 15px; }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; }
.cal .dow { background: var(--panel-2); padding: 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.cal .day { background: var(--panel); min-height: 116px; padding: 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.cal .day:hover { background: var(--panel-2); }
.cal .day.other { background: var(--panel-2); }
.cal .day.other .dnum { color: var(--faint); }
.cal .day.today .dnum { background: var(--accent); color: #fff; }
.cal .day.over { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--soft-acc); }
.dnum { font-size: 12px; font-weight: 600; width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center; }
.chip { font-size: 11.5px; border-radius: 6px; padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--chip-draft); color: var(--ink); border-left: 3px solid var(--faint); }
.chip.scheduled { background: var(--chip-sched); border-left-color: var(--warn); cursor: grab; }
.chip.published { background: var(--chip-pub); border-left-color: var(--ok); }
.chip.failed { background: var(--chip-fail); border-left-color: var(--bad); }
.chip b { font-weight: 700; margin-right: 4px; }
.chip.more { background: transparent; border: 0; color: var(--muted); padding-left: 2px; }
@media (max-width: 700px) { .cal .day { min-height: 70px; padding: 4px; } .chip { font-size: 0; padding: 0; height: 6px; border-left-width: 0; } .chip.more { font-size: 10px; height: auto; } .cal .dow { font-size: 10px; padding: 6px 2px; } }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Queue ---------- */
.day-toggle { display: flex; gap: 6px; flex-wrap: wrap; }
.day-toggle button { width: 48px; padding: 7px 0; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.day-toggle button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.time-chip { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 4px 3px 12px; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.time-chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 999px; width: 22px; height: 22px; font-size: 15px; line-height: 1; }
.qrow { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 6px; border-top: 1px solid var(--line); border-radius: 8px; }
.qrow.filled { cursor: pointer; } .qrow.filled:hover { background: var(--panel-2); }
.qrow .when { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.qrow.open .grow { color: var(--faint); font-style: italic; }
.qrow .clip { white-space: pre-wrap; }
.qday { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 16px 6px 4px; }
.qday:first-child { padding-top: 0; }

/* ---------- Charts ---------- */
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .axis-t { fill: var(--faint); font-size: 10.5px; font-family: inherit; }
.chart .bar { fill: var(--bar); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .cell:hover { opacity: .78; }
.chart .cell { stroke: var(--panel); stroke-width: 2; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--panel); padding: 6px 9px; border-radius: 8px; font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 8px)); opacity: 0; transition: opacity .1s; z-index: 5; }
.tip.show { opacity: 1; }
.scale { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.scale .bar-g { width: 120px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--heat-lo), var(--heat-hi)); }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.t td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--panel-2); }
.table-scroll { overflow-x: auto; }
.clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.metric { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; }
.metric .v { font-weight: 700; font-size: 19px; font-variant-numeric: tabular-nums; }
.metric .l { font-size: 12px; color: var(--muted); }
.spark { width: 100%; height: 64px; display: block; margin-top: 12px; }
.spark .l { fill: none; stroke: var(--bar); stroke-width: 2; }
.spark .a { fill: var(--bar); opacity: .12; }

/* ---------- Replies & library ---------- */
.reply { border-top: 1px solid var(--line); padding: 12px 0; }
.reply.first { border-top: 0; padding-top: 4px; }
.reply.ours { padding-left: 16px; border-left: 3px solid var(--accent); }
.reply .t { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 8px; }
.lib-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.lib-item + .lib-item { margin-top: 10px; }
.lib-item textarea { min-height: 70px; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 10px 18px; border-radius: 12px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; z-index: 50; font-weight: 500; }
#toast.show { opacity: 1; }
#toast.err { background: var(--bad); color: #fff; }
@media (max-width: 900px) { #toast { bottom: 80px; } }
.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.page-head > div:last-child:not(:first-child) { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Trends ---------- */
.topic-form { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.5fr) minmax(0, 1fr) auto; gap: 0 12px; align-items: end; }
.topic-form label.f { margin-top: 0; }
@media (max-width: 900px) { .topic-form { grid-template-columns: minmax(0, 1fr); gap: 10px; } .topic-go .btn { width: 100%; justify-content: center; } }
.kws { display: flex; flex-wrap: wrap; gap: 6px; }
.kw { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12.5px; background: var(--panel); }
.kw b { font-size: 11px; color: var(--muted); background: var(--panel-2); border-radius: 999px; padding: 0 7px; font-variant-numeric: tabular-nums; }
.ideas-box { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }

/* ---------- Channels ---------- */
.chan-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.chan-pick .hint { margin-right: 4px; }
.chan { border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.chan small { font-weight: 500; opacity: .8; }
.chan.on { background: var(--soft-acc); border-color: var(--accent); color: var(--accent-strong); }
.tabs.sm button { padding: 3px 9px; font-size: 12px; }
.sprev { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--panel); }
.sp-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.sp-head .av { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #1d9bf0, #0c5fa3); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.sp-head small { display: block; color: var(--muted); font-size: 12px; }
.sp-text { white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px 12px 12px; font-size: 14px; }
.sp-text .lnk, .sp-text .tag { color: var(--accent-strong); }
.sp-imgs { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.sp-imgs img { width: 100%; height: 150px; object-fit: cover; display: block; }
.sp-imgs.tall { grid-template-columns: 1fr; }
.sp-imgs.tall img { height: auto; aspect-ratio: 1; }
.sp-tiktok .sp-imgs.tall img, .sp-snapchat .sp-imgs.tall img { aspect-ratio: 9 / 14; }
.sp-count { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; border-radius: 999px; padding: 1px 8px; }
.sp-noimg { display: flex; align-items: center; justify-content: center; gap: 8px; height: 140px; background: var(--panel-2); color: var(--muted); font-size: 13px; }
.chan-row { border-top: 1px solid var(--line); padding: 10px 0; }
.chan-row:first-of-type { border-top: 0; padding-top: 0; }
.meta .chans { font-weight: 600; color: var(--ink); }

/* Users, account and sign-in */
.who { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; padding: 6px 4px; border-radius: 8px; }
.who:hover { background: var(--panel-2); }
.who small { display: block; color: var(--muted); font-size: 12px; }
.perms { display: grid; gap: 6px; margin-top: 10px; }
.perm { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.perm input { margin-top: 2px; }
.role-help { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13.5px; }
.role-help li::marker { color: var(--muted); }
table.t.users td { vertical-align: middle; }
.login { max-width: 380px; margin: 12vh auto 0; }
.login .brand { padding: 0 0 8px; }
.login .brand small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
body.signed-out .side, body.signed-out .mobile-top { display: none !important; }
body.signed-out .app { grid-template-columns: minmax(0, 1fr); }
.only-no-publish { display: none; }
body.no-publish .only-no-publish { display: block; }

/* Hide what the signed-in user may not do (the server enforces it as well). */
body.no-write :is(#composeBtn, a[href="#/compose"], #save, #dup, #recycle, [data-act="ideas"]) { display: none !important; }
body.no-publish :is(#queueBtn, #schedule, #when, #publish, #unschedule, .slot-chips, [data-manual]) { display: none !important; }
body.no-publish .sched-box > :is(.row:has(#when), div:has(.slot-chips)) { display: none; }
.role-help.checks { list-style: none; padding-left: 0; }
body.no-remove :is(#del, #unpub) { display: none !important; }
body.no-engage :is([data-reply], #thread, #threadBtn) { display: none !important; }
body.no-trends :is(#addTopic, [data-act="scan"], [data-act="remove"], [data-act="save"]) { display: none !important; }
body.no-settings :is(#saveLib, #addTpl, #addHash, #addTime, [data-rmt], .day-toggle button) { pointer-events: none; }
body.no-settings :is(#saveLib, #addTpl, #addHash, #addTime, [data-rmt]) { display: none !important; }
