/* Flowmind Social — the Content screens (ported from Relay's stylesheet). Shell/base rules live in styles.css;
   this file holds every rule content.js needs: planner (.cp-*), dashboard (.db-*), auto-reply (.ar-*, .ib-*, .qa,
   .nm-*, .pp-*, .kb-*, .ep-*, .fbk, .rp), Messages (.ms-*), the YouTube Studio sheet (.ys-*) and the uploads panel. */

/* ---------- base variants Relay defines that the shell does not ---------- */
.pill.run { color: #2563eb; background: color-mix(in srgb, #2563eb 12%, transparent); animation: pulse 1.6s ease-in-out infinite; }
.pill.ok { color: var(--ok); } .pill.bad { color: var(--danger); } .pill.warn { color: #b45309; }
@media (prefers-color-scheme: dark) { .pill.warn { color: #fbbf24; } }
@keyframes pulse { 50% { opacity: .6; } }
.ok-text { color: var(--ok); }
.eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 12px 0 6px; }
.chip-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--text); }
.chip-btn:hover { border-color: #db2777; color: #db2777; }
.table.res td { font-size: 12.5px; white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.table.res td.clip { max-width: 420px; }
.set { padding: 20px; margin-bottom: 16px; }
.set h2 { font-size: 15px; margin: 0 0 4px; }
.set > p.muted { margin: 0 0 14px; font-size: 13px; }
.set h3 { font-size: 14px; margin: 18px 0 4px; }
.save-bar { position: sticky; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 12px 0; background: var(--bg); z-index: 3; }
.form-row.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .form-row.four { grid-template-columns: 1fr 1fr; } }

/* the content page itself: full width, its own tab state (.tab.on), inline checks, nowrap pills */
.page.cp > [data-body] { min-width: 0; }
.cp .tab.on { color: var(--text); border-bottom-color: var(--text); }
.cp .tabs.ar-pages, .cp .tabs.ar-views, .cp .tabs.ms-filt, .cp .cp-lchips, .cp .kb-tabs { border-bottom: 0; gap: 6px; }
.cp .tabs.ar-pages .tab, .cp .tabs.ar-views .tab, .cp .tabs.ms-filt .tab, .cp .cp-lchips .tab, .cp .kb-tabs .tab { border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; margin: 0; font-size: 13px; background: var(--panel); }
.cp .tabs.ar-pages .tab.on, .cp .tabs.ar-views .tab.on, .cp .tabs.ms-filt .tab.on, .cp .cp-lchips .tab.on, .cp .kb-tabs .tab.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.cp .check, .dialog .check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; font-size: 13px; cursor: pointer; }
.cp .pill, .dialog .pill { flex: none; white-space: nowrap; }
.cp .linkish { font-size: inherit; }
.cp .linkish.small { font-size: 12px; }

/* ---------- Content planner ---------- */
.cp-top { align-items: center; }
.cp-sel { height: 32px; width: auto; min-width: 150px; font-size: 13px; }
.cp-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600; }
.cp-pf { display: inline-grid; place-items: center; min-width: 22px; height: 18px; padding: 0 4px; border-radius: 5px; font-size: 10px; font-weight: 700; letter-spacing: .02em; color: #fff; vertical-align: 1px; }
.cp-youtube { background: #dc2626; } .cp-facebook { background: #2563eb; } .cp-x { background: var(--text); color: var(--bg); }
.cp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 6px; vertical-align: 1px; }
.cp-dot.big { width: 12px; height: 12px; margin: 0; }
.cp-local { white-space: nowrap; }
.cp-calbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.cp-calbar .actions { justify-content: flex-start; }
.cp-tzsel { display: flex; align-items: center; gap: 6px; margin: 0 0 0 auto; font-weight: 400; }
.cp-tzsel select { height: 30px; width: auto; font-size: 12.5px; }
.cp-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cp-day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-height: 180px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cp-day.today { border-color: var(--text); }
.cp-dh { font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 2px 4px; }
.cp-day.today .cp-dh { color: var(--text); }
.cp-none { color: var(--line); font-size: 12px; padding: 2px; }
.cp-ev { text-align: left; border: 1px solid var(--line); border-left: 3px solid var(--pc, var(--line)); border-radius: 7px; background: var(--bg); padding: 6px 7px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; font: inherit; color: inherit; }
.cp-ev:hover { background: var(--hover); }
.cp-evt { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.cp-evn { font-size: 12.5px; font-weight: 500; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cp-evs { font-size: 11px; color: var(--muted); }
.cp-ev.st-published .cp-evs, .cp-ev.st-waiting .cp-evs { color: var(--ok); }
.cp-ev.st-failed .cp-evs { color: var(--danger); }
.cp-ev.st-due .cp-evs, .cp-ev.st-paused .cp-evs { color: #b45309; }
.cp-ev.st-published { opacity: .7; }
.cp-drafts { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-table td { vertical-align: top; }
.cp-when { min-width: 190px; font-size: 13px; }
.cp-ttl { max-width: 380px; }
.cp-ttl .error, .cp-ttl .muted { margin-top: 3px; }
.cp-acts { text-align: right; white-space: nowrap; }
.cp-acts .btn { margin-left: 4px; }
.cp-lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.cp-card { padding: 0; overflow: hidden; text-align: left; cursor: pointer; display: flex; flex-direction: column; font: inherit; color: inherit; }
.cp-card:hover { border-color: var(--muted); }
.cp-thumb { aspect-ratio: 9 / 12; background: var(--hover); display: grid; place-items: center; overflow: hidden; font-size: 28px; color: var(--muted); }
.cp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cp-cbody { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.cp-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cp-mini { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.cp-mini.st-published, .cp-mini.st-waiting { color: var(--ok); } .cp-mini.st-failed { color: var(--danger); } .cp-mini.st-due { color: #b45309; }
.dialog.cp-dlg { max-width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; }
.cp-edhead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.cp-ed { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; }
.cp-edr video, .cp-edr img { width: 100%; border-radius: 8px; background: #000; max-height: 420px; object-fit: contain; }
.cp-noprev { border: 1px dashed var(--line); border-radius: 8px; aspect-ratio: 9 / 16; display: grid; place-items: center; text-align: center; padding: 16px; color: var(--muted); font-size: 12px; }
.cp-posthead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.cp-posthead h3 { margin: 0; font-size: 15px; }
.cp-post { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.cp-post .field { margin-bottom: 4px; }
.cp-post.locked { background: var(--hover); }
.cp-phead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cp-phead select, .cp-phead input[type=date], .cp-phead input[type=time] { height: 32px; width: auto; font-size: 13px; padding: 0 8px; }
.cp-cap { white-space: pre-wrap; font-size: 13px; color: var(--muted); max-height: 120px; overflow: auto; }
.cp-steps { padding-left: 18px; margin: 6px 0 10px; color: var(--muted); }
.cp-steps li { margin: 3px 0; }
.cp-steps code, .sub-lead code { font-size: 12px; background: var(--hover); padding: 1px 5px; border-radius: 4px; }
.cp-page { padding: 12px 14px; margin: 0 0 12px; box-shadow: none; }
.cp-pagehead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cp-accts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.cp-acct { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--line); }
.cp-pform { margin-top: 10px; }
.cp-pfs { display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; min-height: 40px; }
.cp-add summary { list-style: none; display: inline-flex; align-items: center; }
.cp-add summary::-webkit-details-marker { display: none; }
.cp-add[open] summary { margin-bottom: 8px; }
.cp-appnote { font-size: 12.5px; color: var(--muted); padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; margin: 6px 0 10px; }
@media (max-width: 900px) {
  .cp-week { grid-template-columns: 1fr; }
  .cp-day { min-height: 0; }
  .cp-ed { grid-template-columns: 1fr; }
  .cp-table thead { display: none; }
}
.cp-nowrap { white-space: nowrap; }

/* ---------- Content dashboard ---------- */
.db-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.db-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.db-tile { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.db-tile b { font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.db-tile b small { font-size: 15px; color: var(--muted); font-weight: 500; }
.db-tl { font-size: 12px; color: var(--muted); }
.db-ts { font-size: 12px; color: var(--muted); }
.db-tile.warn b { color: #b45309; }
.db-grow { font-size: 12px; font-weight: 600; } .db-grow.up { color: var(--ok); } .db-grow.down { color: var(--danger); }
.db-page { padding: 14px 16px; margin-bottom: 12px; }
.db-ph { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.db-accts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.db-acct { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.db-acct.off { background: var(--hover); }
.db-ah { display: flex; align-items: center; gap: 8px; }
.db-ah .pill { margin-left: auto; }
.db-an { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-big { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.db-big b { font-size: 28px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.db-big span { font-size: 13px; color: var(--muted); }
.db-kv { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 13px; }
.db-kv span { color: var(--muted); }
.db-kv b { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.db-pl { margin: 4px 0 0; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.db-foot { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.db-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
.db-sec { padding: 14px 16px; margin-bottom: 12px; }
.db-cols .db-sec { margin-bottom: 0; }
.db-sec h3 { margin: 0 0 10px; font-size: 15px; }
.db-comments { display: flex; flex-direction: column; gap: 2px; }
.db-c { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: inherit; }
.db-c:hover { background: var(--hover); }
.db-cm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.db-ct { font-size: 13.5px; margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.db-on { margin-top: 2px; }
.db-scroll { overflow-x: auto; }
.db-perf td, .db-perf th { font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) { .db-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .db-accts, .db-cols { grid-template-columns: 1fr; } .db-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.db-needs { display: flex; flex-direction: column; }
.db-need { padding: 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.db-need:first-child { border-top: 0; padding-top: 0; }
.db-nt { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.db-na { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.cp-fbmap { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.cp-fbrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: center; gap: 12px; font-weight: 400; margin: 0; }
.cp-fbrow select { height: 36px; }

/* ---------- Content auto-reply ---------- */
.cp-on { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ok); margin-left: 4px; }
.ar-pages { margin-bottom: 12px; }
.ar-head { display: flex; align-items: center; gap: 16px; padding: 16px 18px; margin-bottom: 12px; flex-wrap: wrap; position: relative; }
.ar-head.on { border-color: var(--ok); }
.ar-title { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 240px; }
.ar-title b { font-size: 16px; }
.ar-switch { position: relative; width: 52px; height: 30px; flex: none; margin: 0; cursor: pointer; }
.ar-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.ar-switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .15s; }
.ar-switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--panel); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.ar-switch input:checked + span { background: var(--ok); }
.ar-switch input:checked + span::after { transform: translateX(22px); }
.ar-switch input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 2px; }
.ar-mode { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ar-mode button { border: 0; background: var(--panel); padding: 8px 14px; cursor: pointer; font-size: 13px; color: var(--muted); }
.ar-mode button.on { background: var(--text); color: var(--bg); }
.ar-mode button:disabled { cursor: default; opacity: .7; }
.ar-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ar-small { font-size: 18px !important; }
.ar-listhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.ar-listhead h3, .ar-listhead .tabs { margin: 0; }
.ar-c { border-top: 1px solid var(--line); padding: 12px 0; display: flex; flex-direction: column; gap: 4px; }
.ar-c.marked { background: color-mix(in srgb, var(--accent, #2563eb) 6%, transparent); }
.ar-mark { width: 16px; height: 16px; margin: 0 2px 0 0; cursor: pointer; flex: none; }
.ar-bulk { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 0 10px; position: sticky; top: 0; z-index: 2; background: var(--panel, #fff); }
.ar-cm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ar-cat { font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.ar-text { font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ar-reply { margin-top: 6px; padding-left: 12px; border-left: 3px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.ar-reply.sent { border-left-color: var(--ok); white-space: pre-wrap; overflow-wrap: anywhere; display: block; }
.ar-reply .actions { justify-content: flex-start; }
.ar-form { border: 0; padding: 0; margin: 0; min-width: 0; }
.ar-pl { display: flex; margin-bottom: 8px; }
.ar-rule { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
.ar-r1 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, .8fr) auto auto auto auto; gap: 10px; align-items: center; }
.ar-warn { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; margin-bottom: 12px; border-color: #b45309; flex-wrap: wrap; }
.ar-warn > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ar-warn .btn { text-decoration: none; display: inline-grid; place-items: center; }
.ar-r1 input, .ar-r1 select, .ar-rule > input { height: 36px; }
.ar-r1 input { font-weight: 600; }
.ar-try { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 900px) { .ar-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ar-r1 { grid-template-columns: 1fr 1fr; } }
.ar-pp { display: flex; align-items: center; gap: 6px; }
.ar-pp input { width: 70px; height: 30px; padding: 2px 8px; }
.ar-pp2 { display: flex; gap: 16px; flex-wrap: wrap; }
.ar-seeds .ar-listhead label { margin: 0; }
.ar-learned { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--hover); display: flex; flex-direction: column; gap: 4px; }
.ar-rx .ar-rxi { font-size: 20px; }
.ar-rx .ar-cm { gap: 10px; }
.ar-catch { margin-left: auto; }
.ar-nocredit { background: rgba(214,150,40,.12); border: 1px solid rgba(214,150,40,.45); border-radius: 10px; padding: 8px 12px; }
.ar-nocredit a { color: inherit; font-weight: 600; }

/* Auto-reply → quick reply under each comment */
.ar-quick { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.ar-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ar-chip { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 99px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ar-chip:hover { background: var(--hover); border-color: var(--muted); }
.ar-qbox { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.ar-qbox textarea { min-height: 36px; resize: vertical; }
.ar-qbtns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 700px) { .ar-qbox { grid-template-columns: 1fr; } .ar-qbtns { justify-content: flex-start; } }

/* Auto-reply: who wrote it, and what a reply answers */
.ar-kind { font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--hover); color: var(--muted); }
.ar-kind.reply { background: rgba(37, 99, 235, .1); color: #2563eb; }
.ar-parent { font-size: 13px; color: var(--muted); padding: 6px 10px; border-left: 3px solid rgba(37, 99, 235, .45); background: var(--hover); border-radius: 0 8px 8px 0; overflow-wrap: anywhere; }
.ar-parent b { color: var(--text); font-weight: 600; }
.ar-parent span:not(.ar-cat):not(.ar-pg) { color: var(--text); }
.ar-pg { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: #4f46e5; color: #fff; }
@media (prefers-color-scheme: dark) { .ar-kind.reply { color: #93c5fd; } }

/* Auto-reply: why a comment wasn't answered, each reason in its own colour */
.ar-why { align-self: flex-start; max-width: 100%; font-size: 12.5px; font-weight: 500; line-height: 1.45; padding: 3px 10px; border-radius: 8px; border: 1px solid transparent; overflow-wrap: anywhere; }
.ar-why.w-you { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.ar-why.w-hide { background: #ede9fe; border-color: #c4b5fd; color: #5b21b6; }
.ar-why.w-bad { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.ar-why.w-done { background: #dcfce7; border-color: #86efac; color: #166534; }
.ar-why.w-media { background: #e0f2fe; border-color: #7dd3fc; color: #075985; }
.ar-why.w-thread { background: #e0e7ff; border-color: #a5b4fc; color: #3730a3; }
.ar-why.w-mine { background: #f1f5f9; border-color: #cbd5e1; color: #334155; }
.ar-why.w-info { background: #ccfbf1; border-color: #5eead4; color: #115e59; }
@media (prefers-color-scheme: dark) {
  .ar-why.w-you { background: rgba(245, 158, 11, .15); border-color: rgba(245, 158, 11, .45); color: #fcd34d; }
  .ar-why.w-hide { background: rgba(139, 92, 246, .16); border-color: rgba(139, 92, 246, .45); color: #c4b5fd; }
  .ar-why.w-bad { background: rgba(239, 68, 68, .15); border-color: rgba(239, 68, 68, .45); color: #fca5a5; }
  .ar-why.w-done { background: rgba(34, 197, 94, .14); border-color: rgba(34, 197, 94, .4); color: #86efac; }
  .ar-why.w-media { background: rgba(14, 165, 233, .14); border-color: rgba(14, 165, 233, .4); color: #7dd3fc; }
  .ar-why.w-thread { background: rgba(99, 102, 241, .16); border-color: rgba(99, 102, 241, .45); color: #a5b4fc; }
  .ar-why.w-mine { background: rgba(148, 163, 184, .14); border-color: rgba(148, 163, 184, .4); color: #cbd5e1; }
  .ar-why.w-info { background: rgba(20, 184, 166, .14); border-color: rgba(20, 184, 166, .4); color: #5eead4; }
}

/* ---- auto-reply inbox (Intercom-style): list · comment + timeline · person */
.ar-views { margin: 4px 0 12px; }
.ib { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr) minmax(220px, 280px); gap: 12px; align-items: start; }
.ib-list, .ib-main, .ib-side { padding: 12px; min-width: 0; }
.ib-list { position: sticky; top: 8px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; }
.ib-rows { overflow: auto; flex: 1; min-height: 200px; margin: 0 -12px -12px; }
.ib-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ib-filters .ar-chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.ib-search { width: 100%; height: 34px; margin-bottom: 8px; }
.ib-list .ar-bulk { padding: 6px 0 8px; position: static; background: none; gap: 8px; }
.ib-row { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); cursor: pointer; align-items: flex-start; }
.ib-row:hover { background: var(--hover); }
.ib-row.on { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); box-shadow: inset 3px 0 0 var(--accent); }
.ib-row.marked { background: color-mix(in srgb, #2563eb 7%, transparent); }
.ib-row.open .ib-prev { color: var(--text); }
.ib-rowm { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.ib-r1 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: 0; }
.ib-r1 b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ib-ago { margin-left: auto; white-space: nowrap; }
.ib-r2 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ib-prev { font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.ib-av { width: 28px; height: 28px; border-radius: 50%; background: var(--hover); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex: none; }
.ib-av.lg { width: 40px; height: 40px; font-size: 15px; }
.ar-mark-gap { width: 16px; flex: none; }
.ib-row .ar-mark { margin-top: 6px; }
.ib-empty { padding: 14px 12px; }
.ib-none { padding: 48px 16px; text-align: center; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.ib-back { display: none; border: 0; background: none; color: var(--muted); font-size: 13px; padding: 0 0 8px; cursor: pointer; }
.ib-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.ib-headm { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ib-bubble { background: var(--hover); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.ib-bubble .ar-text { white-space: pre-wrap; word-break: break-word; }
.ib-sent { position: relative; }
.ib-sentv { margin-right: 4px; }
.ib-compose { margin-top: 6px; }
.ib-thread { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 4px; }
.ib-tl { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.ib-tlh { margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
.ib-ev { display: grid; grid-template-columns: 56px 22px minmax(0, 1fr); gap: 6px; padding: 4px 0; font-size: 13px; align-items: baseline; }
.ib-evt { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.ib-evi { text-align: center; }
.ib-evx { word-break: break-word; color: var(--muted); }
.ib-ev.k-draft .ib-evx, .ib-ev.k-sent .ib-evx { color: var(--text); }
.ib-ev.k-error .ib-evx { color: var(--danger); }
.ib-ev.k-hold .ib-evx { color: #b45309; }
.ib-side { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 12px; }
.ib-sec { display: flex; flex-direction: column; gap: 4px; }
.ib-sech { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ib-kh { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; margin-top: 4px; }
.ib-oth { padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.ib-oth:hover { background: var(--hover); }
.ib-done { margin-top: 12px; }
.ib-done > summary { cursor: pointer; }
.ib-pace { margin: -2px 0 8px; }
.ib-pstats { font-size: 13px; margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ib-othh { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 2px; }
.ar-voice { font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap; }
.ar-voice.v-dadu { background: color-mix(in srgb, #d97706 14%, transparent); border-color: color-mix(in srgb, #d97706 40%, transparent); }
.ar-voice.v-admin { background: color-mix(in srgb, #2563eb 10%, transparent); border-color: color-mix(in srgb, #2563eb 35%, transparent); }
.ar-cat.star { background: color-mix(in srgb, #d97706 14%, transparent); }
.ar-voices { align-items: start; }
.ar-vcard { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.ar-vcard h3 { margin: 0 0 10px; font-size: 15px; }
.ar-vcard .field { margin-bottom: 10px; }
@media (max-width: 1100px) { .ib { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); } .ib-side { grid-column: 1 / -1; position: static; } }
@media (max-width: 760px) {
  .ib { grid-template-columns: 1fr; }
  .ib-list { position: static; max-height: none; }
  .ib.has-sel .ib-list { display: none; }
  .ib:not(.has-sel) .ib-main, .ib:not(.has-sel) .ib-side { display: none; }
  .ib-back { display: inline-block; }
  .kb-grid { grid-template-columns: 1fr; }
  .ar-r1 { grid-template-columns: 1fr 1fr; }
}

/* questions · names · knowledge */
.qa { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.qa textarea { margin-top: 4px; }
.qa-done { padding: 4px 0; border-top: 1px solid var(--line); }
.nm { border-top: 1px solid var(--line); padding: 10px 0; display: flex; flex-direction: column; gap: 4px; }
.nm.used { opacity: .7; }
.kb-set { margin-top: 4px; }
.kb-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 8px; }
.kb-items { display: flex; flex-direction: column; gap: 6px; max-height: 480px; overflow: auto; }
.kb-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.kb-item:hover { background: var(--hover); }
.kb-item.on { border-color: var(--text); }
.kb-item.off { opacity: .55; }
.kb-form { display: flex; flex-direction: column; gap: 8px; }
.kb-test { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.kb-test .ar-qbox { display: flex; gap: 8px; }
.kb-test .ar-qbox input { flex: 1; }
.mcp-note { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* people + replied badges */
.rp { font-size: 12px; padding: 1px 7px; border-radius: 99px; background: var(--hover); color: var(--muted); white-space: nowrap; }
.rp.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.rp.warn { color: #b45309; background: color-mix(in srgb, #b45309 12%, transparent); }
.rp.no { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.pp { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 1.2fr); gap: 12px; align-items: start; }
.pp-table td, .pp-table th { padding: 6px 8px; }
.pp-table td .muted.small { font-weight: 400; }
.pp-list { min-width: 0; overflow-x: auto; }
.pp-row { cursor: pointer; }
.pp-row:hover td { background: var(--hover); }
.pp-row.on td { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.pp-hist { position: sticky; top: 8px; max-height: calc(100vh - 24px); overflow: auto; }
.pp-c { border-top: 1px solid var(--line); padding: 10px 0; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 900px) { .pp { grid-template-columns: 1fr; } .pp.has-sel .pp-list { display: none; } .pp:not(.has-sel) .pp-hist { display: none; } .pp-hist { position: static; max-height: none; } .pp .ib-back { display: inline-block; } }
@media (max-width: 760px) { .pp-table th:nth-child(1), .pp-table td:nth-child(1), .pp-table th:nth-child(4), .pp-table td:nth-child(4), .pp-table th:nth-child(5), .pp-table td:nth-child(5) { display: none; } .pp-table td, .pp-table th { padding: 6px 5px; } .pp-table td:nth-child(2) { max-width: 150px; } }
.fbk { border-top: 1px solid var(--line); padding: 10px 0; display: flex; flex-direction: column; gap: 4px; }
.fbk.noted { opacity: .6; }

/* compact Auto-reply: intro, on/off card and tiles fold into one slim bar */
.ar-slim { display: none; align-items: center; gap: 10px; padding: 8px 14px; margin-bottom: 10px; flex-wrap: wrap; }
.ar-slim.on { border-color: var(--ok); }
.ar-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.ar-dot.on { background: var(--ok); }
.ar-hide { position: absolute; top: 8px; right: 12px; }
.cp-compact .ar-slim { display: flex; }
.cp-compact .ar-head, .cp-compact .ar-tiles, .cp-compact .page-head .sub-lead { display: none; }
.cp-compact .page-head { margin-bottom: 8px; }

/* name requests: how close the person is to the page */
.nm-stats { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 2px; }
.nm-st { background: var(--soft, rgba(127,127,127,.08)); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; white-space: nowrap; font: inherit; color: inherit; }
button.nm-st { cursor: pointer; }
button.nm-st:hover { border-color: var(--accent, #4a7); }
.nm-st.warn { border-color: rgba(214,150,40,.5); }
.nm-st.ok { border-color: rgba(60,160,90,.5); }
.nm-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.nm-bar .ib-search { flex: 1 1 200px; max-width: 300px; margin: 0; }
.nm-sort { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.nm-sort select { padding: 4px 8px; height: auto; width: auto; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; }
.nm-count { align-self: center; margin-left: 4px; }
/* name requests: the person's picture */
.nm-row { display: flex; gap: 12px; align-items: flex-start; }
.nm-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.nm-av { flex: none; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--hover); border: 1px solid var(--line); font-weight: 600; font-size: 20px; color: var(--muted); text-decoration: none; }
.nm-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
a.nm-av:hover { outline: 2px solid var(--text); }
.nm-picnote { background: var(--hover); border-radius: 8px; padding: 6px 10px; }
.nm-picked { border-color: var(--ok, #3a9b5c); }
@media (max-width: 760px) { .nm-av { width: 44px; height: 44px; font-size: 16px; } }

/* 🎙 episodes */
.ep-wrap { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
.ep-card { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 10px; padding: 9px 12px; margin: 6px 0; cursor: pointer; font: inherit; }
.ep-card .muted:last-child { margin-left: auto; }
.ep-card:hover { background: var(--hover); }
.ep-card.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.ep-reg { padding: 3px 0; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .ep-wrap { grid-template-columns: 1fr; } }

/* ---------- Content → Messages (Messenger inbox) ---------- */
.ms-setup { padding: 16px 18px; margin-bottom: 12px; border-color: #b45309; }
.ms-setup h3 { margin: 0 0 10px; }
.ms-setup ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ms-setup li { display: flex; gap: 10px; align-items: flex-start; }
.ms-setup li > span { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.ms-setup li.ok > span { background: var(--ok); border-color: var(--ok); color: #fff; }
.ms-setup li > div { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.ms-setup li.ok > div { color: var(--muted); }
.ms-setup .btn { text-decoration: none; display: inline-grid; place-items: center; }
.ms-review { margin: 0 0 12px; }
.ms-inbox { display: grid; grid-template-columns: 300px minmax(0, 1fr); padding: 0; overflow: hidden; margin-bottom: 16px; min-height: 520px; }
.ms-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; max-height: 720px; overflow-y: auto; }
.ms-filt { margin: 0; padding: 10px 10px 6px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.ms-none { padding: 12px 14px; }
.ms-t { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; cursor: pointer; color: var(--text); font: inherit; width: 100%; }
.ms-t:hover { background: var(--hover); }
.ms-t.on { background: var(--hover); box-shadow: inset 3px 0 0 var(--text); }
.ms-t.unread b { font-weight: 700; }
.ms-av { width: 36px; height: 36px; border-radius: 50%; background: var(--hover); border: 1px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.ms-tm { display: flex; flex-direction: column; min-width: 0; }
.ms-tm b, .ms-tm span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-ts { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.ms-ts i { font-style: normal; font-size: 13px; margin-left: 2px; }
.ms-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2563eb; vertical-align: middle; }
.ms-chat { display: flex; flex-direction: column; min-width: 0; }
.ms-pick { margin: auto; border: 0; }
.ms-chead { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ms-who { display: flex; flex-direction: column; flex: 1; min-width: 180px; }
.ms-chead .actions { margin: 0; }
.ms-flag { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 9px 14px; background: rgba(180, 83, 9, .1); border-bottom: 1px solid rgba(180, 83, 9, .35); font-size: 13.5px; }
.ms-log { flex: 1; min-height: 240px; max-height: 460px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ms-m { display: flex; flex-direction: column; max-width: 78%; align-self: flex-start; align-items: flex-start; }
.ms-m.out { align-self: flex-end; align-items: flex-end; }
.ms-m.pending { opacity: .6; }
.ms-b { position: relative; padding: 8px 12px; border-radius: 16px; background: var(--hover); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.45; }
.ms-m.out .ms-b { background: #2563eb; border-color: #2563eb; color: #fff; }
.ms-m.out.ai .ms-b { background: #4f46e5; border-color: #4f46e5; }
.ms-m.out a { color: inherit; }
.ms-att { font-size: 13px; }
.ms-rx { position: absolute; bottom: -10px; right: -6px; font-size: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 0 4px; line-height: 18px; }
.ms-m.out .ms-rx { right: auto; left: -6px; }
.ms-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; padding: 0 4px; }
.ms-draft { margin: 0 14px 10px; padding: 10px 12px; border: 1px dashed #4f46e5; border-radius: 10px; display: flex; flex-direction: column; gap: 8px; }
.ms-draft .actions, .ms-note .actions { justify-content: flex-start; margin: 0; }
.ms-compose { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.ms-rxbar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ms-rxb { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; width: 30px; height: 28px; cursor: pointer; font-size: 14px; padding: 0; }
.ms-rxb:hover { background: var(--hover); transform: scale(1.1); }
.ms-cbox { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: end; }
.ms-note { border-top: 1px solid var(--line); padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 6px; background: rgba(250, 204, 21, .06); }
.ms-note .actions { justify-content: flex-end; gap: 10px; }
.ms-settings > summary { display: flex; align-items: baseline; gap: 12px; cursor: pointer; list-style: none; }
.ms-settings > summary::-webkit-details-marker { display: none; }
.ms-settings > summary h2 { margin: 0; }
.ms-settings > summary::before { content: "▸"; color: var(--muted); }
.ms-settings[open] > summary::before { content: "▾"; }
.ms-settings[open] > summary { margin-bottom: 12px; }
.ms-h3 { margin: 18px 0 8px; font-size: 15px; }
.ms-r1 { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) auto auto auto; }
.ms-back { display: none; }
@media (max-width: 900px) {
  .ms-inbox { grid-template-columns: 1fr; }
  .ms-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 300px; }
  .ms-m { max-width: 92%; }
  .ms-cbox { grid-template-columns: 1fr 1fr; } .ms-cbox textarea { grid-column: 1 / -1; }
  .ms-r1 { grid-template-columns: 1fr 1fr; }
}

/* ---------- Content → YouTube Studio fields (editor) and copy sheet ---------- */
.cp-studio { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.cp-studio > summary { cursor: pointer; font-weight: 600; }
.ys-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin-top: 10px; }
.ys-grid .ys-wide { grid-column: 1 / -1; }
.dialog.ys-dialog { max-width: min(1000px, calc(100vw - 32px)); width: calc(100% - 32px); max-height: calc(100vh - 40px); overflow: auto; }
.ys-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; position: sticky; top: -1px; background: var(--panel); padding-bottom: 10px; border-bottom: 1px solid var(--line); z-index: 1; }
.ys-head h2 { margin: 0 0 2px; }
.ys-head .actions { margin: 0; gap: 8px; }
.ys-head a.btn { text-decoration: none; }
.ys-body h3 { margin: 18px 0 6px; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ys-row { display: grid; grid-template-columns: 190px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 9px 0; border-top: 1px solid var(--line); }
.ys-k { font-weight: 600; font-size: 13.5px; display: flex; flex-direction: column; gap: 2px; }
.ys-v { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; max-height: 260px; overflow: auto; }
.ys-thumbs { display: flex; gap: 10px; flex-wrap: wrap; white-space: normal; max-height: none; }
.ys-thumbs figure { margin: 0; width: 220px; }
.ys-thumbs img { width: 220px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.ys-thumbs figcaption { font-size: 12px; margin-top: 4px; display: flex; justify-content: space-between; }
.ys-box { margin: 6px 0; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 10px; background: var(--hover); }
.ys-box .ys-row:first-of-type { border-top: 0; }
.ys-more { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ys-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.ys-files { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--hover); display: flex; flex-direction: column; gap: 6px; }
.ys-fk { font-size: 12.5px; font-weight: 600; margin-top: 4px; }
.ys-path { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 3px; white-space: normal; }
.ys-path code { font-size: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; overflow-wrap: anywhere; }
.ys-thumbs .ys-path code { font-size: 11px; }
@media (max-width: 700px) { .ys-row { grid-template-columns: 1fr; } .ys-grid { grid-template-columns: 1fr; } }

/* ---------- Content → Library filters ---------- */
.cp-lbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.cp-lbar input[type=search] { max-width: 420px; }
.cp-lchips { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-lchips .tab { margin: 0; }
.cp-lsels { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cp-lsel { height: 34px; width: auto; min-width: 140px; }
.cp-lsel.on { border-color: var(--text); font-weight: 600; }

/* ---------- uploads: the editor's media picker, the Library's Files panel ---------- */
.cp-media { display: flex; gap: 6px; align-items: center; }
.cp-media input { flex: 1; min-width: 0; }
.cp-media .btn { flex: none; }
.cp-up { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.cp-upbar { flex: 1; height: 6px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.cp-upbar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .15s; }
.cp-pick { max-height: 60vh; overflow: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; }
.cp-pick button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: none; padding: 8px 10px; cursor: pointer; font: inherit; color: inherit; }
.cp-pick button:first-child { border-top: 0; }
.cp-pick button:hover { background: var(--hover); }
.cp-pick button b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cp-files { padding: 14px 16px; margin-bottom: 14px; }
.cp-files > summary { cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; list-style: none; }
.cp-files > summary::-webkit-details-marker { display: none; }
.cp-files > summary::before { content: "▸"; color: var(--muted); }
.cp-files[open] > summary::before { content: "▾"; }
.cp-files > summary h3 { margin: 0; font-size: 15px; }
.cp-fbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.cp-fbar select { height: 32px; width: auto; font-size: 13px; }
.cp-flist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cp-file { border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cp-fprev { aspect-ratio: 16 / 10; background: var(--hover); border-radius: 6px; display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 24px; }
.cp-fprev img, .cp-fprev video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cp-fname { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-fmeta { display: flex; justify-content: space-between; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.cp-fmeta .actions { gap: 4px; }

/* ---------- phones: content on a small screen ---------- */
@media (max-width: 720px) {
  .page.wide.cp { padding: 14px 14px 40px; }
  .cp .page-head .sub-lead { display: none; }
  .cp .card.set { padding: 14px; }
  .cp-top { width: 100%; flex-wrap: nowrap; justify-content: flex-start; }
  .cp-top .cp-sel { flex: 1; min-width: 0; }
  .cp-top .btn { flex: none; }
  .ar-head { padding: 14px; gap: 12px; }
  .ar-title { flex: 1 1 0; min-width: 0; }
  .ar-mode { display: flex; width: 100%; }
  .ar-mode button { flex: 1; padding: 9px 8px; }
  .db-tile { padding: 12px; }
  .db-tile b { font-size: 22px; }
  .db-sec { padding: 12px; }
  .ar-listhead .tabs { width: 100%; }
  .ar-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -12px; padding-right: 12px; }
  .ar-chips::-webkit-scrollbar { display: none; }
  .ar-chip { flex: none; max-width: 78vw; padding: 6px 12px; }
  .ar-qbtns .btn { flex: 1 0 auto; }
  .ar-cm { gap: 6px; }
  .ar-reply { padding-left: 10px; }
  .save-bar { position: static; padding: 14px 0 4px; }
  .save-bar .btn { width: 100%; }
  .ar-r1, .ms-r1 { display: flex; flex-wrap: wrap; gap: 8px 14px; }
  .ar-r1 > [data-rk=name] { flex: 1 1 0; min-width: 0; order: 0; }
  .ar-r1 > [data-rmrule] { order: 1; flex: none; }
  .ar-r1 > select { flex: 1 1 100%; order: 2; }
  .ar-r1 > label { order: 3; margin: 0; }
  .ms-r1 > * { flex: 1 1 100%; }
  .ms-r1 > label { flex: 0 1 auto; margin: 0; }
  .ar-rule { padding: 10px; }
  .ar-pp { display: block; line-height: 2.3; }
  .ar-pp input { display: inline-block; vertical-align: middle; width: 64px; margin: 0 4px; }
  .ms-inbox { min-height: 0; }
  .ms-list { max-height: none; border-bottom: 0; }
  .ms-inbox:not(.open) .ms-chat { display: none; }
  .ms-inbox.open .ms-list { display: none; }
  .ms-back { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 0 3px; }
  .ms-chead { padding: 10px 12px; gap: 8px; }
  .ms-who { min-width: 0; flex: 1 1 0; }
  .ms-chead .actions { width: 100%; justify-content: flex-start; }
  .ms-log { max-height: 58vh; padding: 12px 10px; }
  .ms-m { max-width: 88%; }
  .ms-draft { margin: 0 10px 10px; }
  .ms-compose, .ms-note { padding: 10px; }
  .cp-media { flex-wrap: wrap; }
  .cp-media input { flex: 1 1 100%; }
}

/* the full-height content page is a flex column: its rows keep their height (the tab strip was squashed to 1px) */
.page.wide > * { flex-shrink: 0; }
@media (min-width: 761px) { .cp > .tabs.cp-main { display: none; } }

/* inbox: the filter is one dropdown next to the search box (was a wall of chips) */
.ib-filterbar { display: flex; gap: 6px; margin-bottom: 8px; }
.ib-filterbar .ib-fsel { flex: 0 0 auto; width: auto; max-width: 55%; height: 34px; padding: 0 28px 0 10px; font-weight: 500; }
.ib-filterbar .ib-search { flex: 1 1 auto; min-width: 0; margin: 0; }

/* phones: content page details */
@media (max-width: 760px) {
  .cp .cp-top { width: 100%; }
  .cp .cp-top .cp-sel { flex: 1; min-width: 0; }
  .cp > .tabs.cp-main { position: sticky; top: 45px; z-index: 20; background: var(--bg); margin: 0 -12px 12px; padding: 0 12px; }
  .ar-hide { position: static; margin-left: auto; }
  .ar-head { gap: 10px; }
  .ar-tiles { display: flex; overflow-x: auto; gap: 8px; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .ar-tiles > * { flex: 0 0 46%; scroll-snap-align: start; }
  .ib-list, .ib-main, .ib-side { padding: 10px; }
  .ib-filterbar .ib-fsel { max-width: 50%; }
  .ib-list .ar-bulk { flex-wrap: wrap; }
}
@media (max-width: 760px) {
  /* jumping to an open comment / chat / person stops below the pinned top bar and section tabs */
  .ib-main, .ms-chat, .ms-inbox, .pp-hist, .ep-detail { scroll-margin-top: 96px; }
}

/* phones: free the top — the menu / bottom bar replace the section tabs; the ON/OFF blocks live in Settings */
.ar-vbar, .ms-slim { display: none; }
@media (max-width: 760px) {
  .cp > .tabs.cp-main { display: none; }
  .cp-tab-autoreply .ar-slim, .cp-tab-autoreply .ar-head, .cp-tab-autoreply .ar-tiles { display: none !important; }
  .cp-tab-autoreply.ar-view-settings .ar-head { display: flex !important; }
  .cp-tab-autoreply.ar-view-settings .ar-tiles { display: flex !important; }
  .ar-vbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
  .ar-vbar select { flex: 1; min-width: 0; height: 40px; font-weight: 600; }
  .ar-stat { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; font-size: 13px; color: var(--muted); }
  .ar-stat.on { border-color: var(--ok); color: var(--ok); }
  .tabs.ar-views { display: none; }
  .cp-tab-messages .ar-head, .cp-tab-messages .ar-tiles { display: none; }
  .cp-tab-messages.ms-showhead .ar-head { display: flex; } .cp-tab-messages.ms-showhead .ar-tiles { display: flex; }
  .ms-slim { display: flex; width: 100%; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 10px; text-align: left; cursor: pointer; }
  .ms-slim.on { border-color: var(--ok); }
  .cp .page-head { margin-bottom: 10px; }
}
@media (max-width: 760px) { .cp-tab-autoreply .ar-hide { display: none; } }

/* comment detail: the timeline is folded until you ask for it; knowledge shows only which items matched */
details.ib-tl > summary { cursor: pointer; list-style: none; padding: 8px 0; font-weight: 600; user-select: none; }
details.ib-tl > summary::-webkit-details-marker { display: none; }
details.ib-tl > summary::after { content: ' ▸'; } details.ib-tl[open] > summary::after { content: ' ▾'; }
.ib-kh { padding: 3px 0; } .ib-khn { font-weight: 600; }

/* open comment: Next / Prev through the list you are working on */
.ib-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.ib-nav .ib-pos { margin-right: auto; }
.ib-nav .ib-back { margin: 0; }
@media (max-width: 760px) { .ib-nav { position: sticky; top: 45px; z-index: 15; background: var(--panel); padding: 6px 0; margin: -6px 0 8px; } .ib-nav .btn { min-height: 36px; } }

/* commenter pictures in the inbox (the initial underneath is the fallback) */
.ib-av { position: relative; overflow: hidden; }
.ib-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Messenger: pictures, stickers, voice notes and videos in the chat */
.ms-pic { display: block; margin-top: 4px; }
.ms-pic img { display: block; max-width: min(260px, 100%); max-height: 320px; border-radius: 12px; object-fit: cover; }
.ms-pic.sticker img { max-width: 120px; max-height: 120px; background: none; object-fit: contain; }
audio.ms-att { display: block; max-width: 260px; margin-top: 4px; }
.ms-vid { display: block; max-width: min(300px, 100%); max-height: 360px; border-radius: 12px; margin-top: 4px; }

/* Messenger: 🙋 wants the admin — its own tile, section and banner */
.cp-tab-messages .ar-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .cp-tab-messages .ar-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .cp-tab-messages .ar-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.db-tile[data-f] { cursor: pointer; }
.ms-flag.admin { background: rgba(37, 99, 235, .1); border-bottom-color: rgba(37, 99, 235, .35); }
.ms-filt { display: flex; flex-wrap: wrap; }
