/* CRM Salam — Autopost module. Reuses CRM tokens from styles.css (--panel, --text,
   --muted, --accent, --warn, --danger, --crm-border). Mobile first. */
.autopost-panel { display: block; }
.ap-root { display: grid; gap: 14px; min-width: 0; }
.ap-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-start; }
.ap-head h3 { margin: 2px 0 4px; }
.ap-head-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ap-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.ap-tabs .chip { white-space: nowrap; }
.ap-body { display: grid; gap: 14px; min-width: 0; }
.ap-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 980px) { .ap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ap-card { background: var(--panel, #fff); border: 1px solid var(--crm-border, #d9e4ef); border-radius: 14px; padding: 14px; display: grid; gap: 10px; min-width: 0; }
.ap-card h4 { margin: 0; font-size: 1rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ap-field { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; color: var(--text, #172033); }
.ap-field input, .ap-field select, .ap-field textarea, .ap-filters input, .ap-filters select, .ap-resched input {
  width: 100%; box-sizing: border-box; font: inherit; font-weight: 400; font-size: 16px; /* 16px stops iOS zoom */
  padding: 10px 12px; border: 1px solid var(--crm-border, #d9e4ef); border-radius: 10px; background: var(--panel-strong, #f8fafc); color: var(--text, #172033);
}
.ap-field textarea { resize: vertical; }
.ap-check { display: flex; gap: 8px; align-items: center; font-size: .9rem; }
.ap-fieldset { border: 1px dashed var(--crm-border, #d9e4ef); border-radius: 10px; padding: 10px; display: grid; gap: 8px; margin: 0; }
.ap-count { color: var(--muted, #66758b); }
.ap-filters { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .ap-filters { grid-template-columns: 2fr 1fr 1fr; } }
.ap-row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ap-row-actions .ghost-button, .ap-row-actions .primary-button { min-height: 44px; }
.ap-wide { width: 100%; min-height: 48px; }
.ap-pill { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg-soft, #edf2f7); color: var(--muted, #66758b); }
.ap-accounts { display: grid; gap: 8px; max-height: 460px; overflow-y: auto; }
.ap-accounts-list { max-height: none; }
.ap-acct { display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--crm-border, #d9e4ef); border-radius: 12px; min-height: 44px; }
.ap-accounts-list .ap-acct { grid-template-columns: auto 1fr auto; }
.ap-accounts-list .ap-acct .ap-row-actions { grid-column: 1 / -1; }
.ap-acct input[type="checkbox"] { width: 22px; height: 22px; }
.ap-checked { border-color: var(--accent, #10b981); box-shadow: 0 0 0 1px var(--accent, #10b981) inset; }
.ap-disabled { opacity: .55; }
.ap-acct-copy { display: grid; gap: 2px; min-width: 0; }
.ap-acct-copy span, .ap-acct-copy small { color: var(--muted, #66758b); font-size: .82rem; overflow-wrap: anywhere; }
.ap-avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; font-size: .8rem; color: #fff; background: #64748b; flex: none; }
.ap-pf-threads { background: #111827; }
.ap-pf-facebook { background: #1d4ed8; }
.ap-pf-instagram { background: linear-gradient(135deg, #f59e0b, #db2777 60%, #7c3aed); }
.ap-pf-tiktok { background: #0f172a; box-shadow: 2px 0 0 #22d3ee inset, -2px 0 0 #f43f5e inset; }
.ap-cap { font-size: .72rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.ap-cap-auto { background: #dcfce7; color: #166534; }
.ap-cap-action { background: #fef3c7; color: #92400e; }
.ap-cap-off { background: #e2e8f0; color: #334155; }
.ap-cap-na { background: #fee2e2; color: #991b1b; }
.ap-legend { font-size: .8rem; color: var(--muted, #66758b); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ap-media { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ap-media figure { position: relative; margin: 0; }
.ap-media img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--crm-border, #d9e4ef); }
.ap-media .ap-x { position: absolute; top: 2px; right: 2px; }
.ap-upload { cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; }
.ap-x { border: 0; background: rgba(15, 23, 42, .7); color: #fff; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 16px; line-height: 1; }
.ap-facts { background: var(--bg-soft, #edf2f7); border-radius: 10px; padding: 10px; font-size: .88rem; }
.ap-facts p { margin: 4px 0; white-space: pre-wrap; }
.ap-preview { border-color: var(--accent, #10b981); }
.ap-final { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: .9rem; }
.ap-preview-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .ap-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .ap-preview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ap-pv { border: 1px solid var(--crm-border, #d9e4ef); border-radius: 12px; padding: 12px; display: grid; gap: 8px; min-width: 0; }
.ap-pv header { display: flex; gap: 10px; align-items: center; }
.ap-pv header div { display: grid; gap: 2px; min-width: 0; }
.ap-pv header span { color: var(--muted, #66758b); font-size: .8rem; }
.ap-pv img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; }
.ap-pv small { color: var(--muted, #66758b); }
.ap-pv-bad { border-color: var(--danger, #ef4444); }
.ap-caption { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: .92rem; margin: 0; background: var(--panel-strong, #f8fafc); padding: 10px; border-radius: 8px; }
.ap-err { color: #b91c1c; margin: 0; font-size: .86rem; }
.ap-warn { color: #92400e; margin: 0; font-size: .86rem; }
.ap-bad { color: #b91c1c; }
.ap-msg { border-radius: 10px; padding: 10px 40px 10px 12px; position: relative; font-size: .9rem; }
.ap-msg .ap-x { position: absolute; right: 8px; top: 8px; }
.ap-msg-good { background: #dcfce7; color: #14532d; }
.ap-msg-bad { background: #fee2e2; color: #7f1d1d; }
.ap-msg-info { background: #e0f2fe; color: #0c4a6e; }
.ap-post-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ap-post-head div { display: grid; gap: 2px; }
.ap-post-head span { color: var(--muted, #66758b); font-size: .82rem; }
.ap-snippet { margin: 0; color: var(--muted, #66758b); font-size: .88rem; white-space: pre-wrap; }
.ap-jobs { display: grid; gap: 8px; }
.ap-job { border-top: 1px solid var(--crm-border, #d9e4ef); padding-top: 8px; display: grid; gap: 6px; }
.ap-job-main { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.ap-job-main div { display: grid; gap: 2px; min-width: 0; }
.ap-job-main span, .ap-job-main small { color: var(--muted, #66758b); font-size: .82rem; overflow-wrap: anywhere; }
.ap-status { font-size: .72rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.ap-st-good { background: #dcfce7; color: #166534; }
.ap-st-info { background: #e0f2fe; color: #075985; }
.ap-st-muted { background: #e2e8f0; color: #334155; }
.ap-st-warn { background: #fef3c7; color: #92400e; }
.ap-st-bad { background: #fee2e2; color: #991b1b; }
.ap-resched { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ap-resched input { width: auto; }
.ap-history { margin: 6px 0 0; padding-left: 18px; font-size: .8rem; color: var(--muted, #66758b); display: grid; gap: 2px; }
@media (max-width: 520px) {
  .ap-acct { grid-template-columns: auto auto 1fr; }
  .ap-acct > .ap-cap { grid-column: 3; justify-self: start; }
  .ap-job-main { grid-template-columns: auto 1fr; }
  .ap-job-main .ap-status { grid-column: 2; justify-self: start; }
  .ap-row-actions > * { flex: 1 1 auto; }
}
.ap-alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .88rem; }
.ap-alerts li { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.ap-dl { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 4px 12px; margin: 0; font-size: .88rem; }
.ap-dl dt { color: var(--muted, #66758b); }
.ap-dl dd { margin: 0; overflow-wrap: anywhere; }

/* Thread 3 berangkai */
.ap-part small { font-weight: 400; color: var(--muted, #66758b); }
.ap-thread { list-style: none; margin: 0; padding: 0 0 0 14px; display: grid; gap: 10px; border-left: 2px solid var(--crm-border, #d9e4ef); }
.ap-thread li { position: relative; display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--crm-border, #d9e4ef); border-radius: 10px; min-width: 0; }
.ap-thread li::before { content: ""; position: absolute; left: -21px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent, #10b981); }
.ap-thread li.ap-pv-bad { border-color: var(--danger, #dc2626); }
.ap-thread-tag { font-size: .75rem; font-weight: 700; color: var(--muted, #66758b); }
.ap-thread-progress { font-size: .82rem; font-weight: 600; color: var(--text, #172033); }
.ap-thread-links { margin: 2px 0 0; padding-left: 18px; font-size: .82rem; color: var(--muted, #66758b); }
.ap-thread-links a { overflow-wrap: anywhere; }
