/* Social Channels — the channel registry (Module 1).
 *
 * One row per client per platform, linking an Agri360 client to the Postiz
 * integration that actually publishes for it. Everything is namespaced .sch-*
 * so nothing leaks into the rest of the CRM.
 *
 * Visual language is deliberately the SAME as Client Retention and the
 * deliverable dashboard: white cards on a light page, 1px #e5e7eb borders,
 * 12-14px radii, the #10141b dark command strip, #2563eb as the single
 * primary, uppercase 10.5px table headers, 999px pills. Global custom props
 * come from ui/css/styles.css and are used with hard fallbacks, same as
 * client-retention.css. The app is light-only, so there is no dark variant.
 */

.sch-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── header ──────────────────────────────────────────────────────────────── */
.sch-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.sch-head-titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sch-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; color: var(--text-primary, #1a1a1a); }
.sch-sub { font-size: 13px; color: var(--text-muted, #666); max-width: 74ch; line-height: 1.45; }
.sch-head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── buttons ─────────────────────────────────────────────────────────────── */
.sch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-color, #e5e7eb);
  background: var(--card-bg, #fff);
  color: var(--text-primary, #1a1a1a);
  border-radius: 8px;
  padding: 8px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease;
}
.sch-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.sch-btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.sch-btn:disabled { opacity: .55; cursor: default; }
.sch-btn:disabled:hover { background: var(--card-bg, #fff); border-color: var(--border-color, #e5e7eb); }
.sch-btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.sch-btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.sch-btn-primary:disabled:hover { background: #2563eb; border-color: #2563eb; }
.sch-btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.sch-btn-danger { color: #b91c1c; border-color: #fecaca; }
.sch-btn-danger:hover { background: #fef2f2; border-color: #fca5a5; }

/* ── command strip (dark headline, mirrors .crb-cmd) ─────────────────────── */
.sch-cmd {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(37, 99, 235, 0.22), transparent 55%),
    #10141b;
  border: 1px solid #10141b;
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.sch-cmd-lead { display: flex; flex-direction: column; gap: 3px; flex-shrink: 0; min-width: 220px; }
.sch-cmd-kicker { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; color: #8b95a5; }
.sch-cmd-figure { display: flex; align-items: baseline; gap: 10px; }
.sch-cmd-num { font-size: 46px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: #fff; font-feature-settings: "tnum"; }
.sch-cmd-num-l { font-size: 13px; font-weight: 600; color: #aeb6c2; }
.sch-cmd-note { font-size: 11.5px; color: #7c8798; max-width: 40ch; line-height: 1.35; }

.sch-cmd-vitals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.sch-vital {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 11px;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  min-width: 0;
}
.sch-vital-dot { width: 8px; height: 8px; border-radius: 999px; grid-row: 1; grid-column: 1; align-self: center; }
.sch-vital-n { grid-row: 1; grid-column: 2; font-size: 22px; font-weight: 800; line-height: 1; color: #fff; font-feature-settings: "tnum"; }
.sch-vital-l { grid-row: 2; grid-column: 1 / -1; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: #8b95a5; font-weight: 700; margin-top: 5px; }
.sch-vital.is-alarm { background: rgba(220, 38, 38, 0.16); border-color: rgba(248, 113, 113, 0.42); }
.sch-vital.is-alarm .sch-vital-l { color: #fca5a5; }

.sch-dot-green { background: #16a34a; }
.sch-dot-red { background: #dc2626; }
.sch-dot-slate { background: #64748b; }
.sch-dot-dark { background: #94a3b8; }

/* ── notice cards (Postiz configuration + connection guidance) ───────────── */
.sch-notice {
  border: 1px solid var(--border-color, #e5e7eb);
  background: var(--card-bg, #fff);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sch-notice-warn { border-color: #fcd9a5; background: linear-gradient(180deg, #fffbf3, #fff); }
.sch-notice-info { border-color: #cddffb; background: linear-gradient(180deg, #f7faff, #fff); }
.sch-notice-hd { display: flex; align-items: center; gap: 8px; }
.sch-notice-tag {
  font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 6px; white-space: nowrap;
}
.sch-notice-warn .sch-notice-tag { background: #fef3c7; color: #92600e; }
.sch-notice-info .sch-notice-tag { background: #dbeafe; color: #1d4ed8; }
.sch-notice-title { font-size: 14px; font-weight: 700; color: var(--text-primary, #1a1a1a); }
.sch-notice-body { font-size: 13px; color: var(--text-secondary, #444); line-height: 1.55; max-width: 88ch; }
.sch-notice-steps { margin: 4px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; }
.sch-notice-steps li { font-size: 13px; color: var(--text-secondary, #444); line-height: 1.5; }
.sch-notice-steps code {
  background: #f1f5f9; border-radius: 5px; padding: 1px 6px;
  font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #334155;
}
.sch-notice-foot { font-size: 12px; color: var(--text-muted, #666); line-height: 1.5; }

/* ── filter bar ──────────────────────────────────────────────────────────── */
.sch-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sch-search { position: relative; flex: 1 1 240px; min-width: 0; display: flex; align-items: center; }
.sch-search-ic { position: absolute; left: 10px; display: inline-flex; color: #94a3b8; pointer-events: none; }
.sch-search-input {
  width: 100%; box-sizing: border-box; padding: 8px 12px 8px 32px;
  border: 1px solid var(--border-color, #d1d5db); border-radius: 9px;
  font: inherit; font-size: 13px; background: #fff; color: var(--text-primary, #1a1a1a);
}
.sch-search-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.sch-select {
  border: 1px solid var(--border-color, #d1d5db); background: #fff; color: var(--text-primary, #1a1a1a);
  border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 12.5px; cursor: pointer; max-width: 220px;
}
.sch-select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.sch-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.sch-chip {
  border: 1px solid var(--border-color, #e5e7eb); background: #fff; color: var(--text-secondary, #444);
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.sch-chip:hover { border-color: #cbd5e1; background: #f8fafc; }
.sch-chip.active { background: #10141b; border-color: #10141b; color: #fff; }
.sch-chip:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }
.sch-chip-c { font-weight: 800; font-feature-settings: "tnum"; opacity: .75; margin-left: 4px; }

/* ── table ───────────────────────────────────────────────────────────────── */
.sch-tablewrap { width: 100%; overflow-x: auto; border: 1px solid var(--border-color, #e5e7eb); border-radius: 12px; background: #fff; }
.sch-table { width: 100%; border-collapse: collapse; font-size: 12.5px; background: #fff; min-width: 940px; }
.sch-table th {
  background: #f8fafc; text-align: left; padding: 10px 12px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-muted, #666); border-bottom: 1px solid var(--border-color, #e5e7eb); white-space: nowrap;
}
.sch-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-color, #eef0f2); color: var(--text-secondary, #444); vertical-align: middle; }
.sch-table tr:last-child td { border-bottom: 0; }
.sch-table tbody tr:hover td { background: #fbfcfe; }

/* An expired or revoked channel blocks scheduling for its platform, so it gets
   a loud left edge and a tinted row rather than just a quieter pill. */
.sch-table tr.sch-row-blocked td { background: #fffafa; }
.sch-table tr.sch-row-blocked:hover td { background: #fff5f5; }
.sch-table tr.sch-row-blocked td:first-child { box-shadow: inset 3px 0 0 #dc2626; }
.sch-table tr.sch-row-dead td:first-child { box-shadow: inset 3px 0 0 #475569; }

.sch-td-client { font-weight: 700; color: var(--text-primary, #1a1a1a); }
.sch-td-act { white-space: nowrap; text-align: right; }
.sch-td-act .sch-btn + .sch-btn { margin-left: 6px; }
.sch-muted { color: #94a3b8; }

/* platform cell */
.sch-plat { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.sch-plat-ico { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; }
.sch-plat-name { font-weight: 600; color: var(--text-primary, #1a1a1a); }
.sch-plat-facebook  { background: #e7f0fe; color: #1877f2; }
.sch-plat-instagram { background: #fdeaf3; color: #c13584; }
.sch-plat-linkedin  { background: #e5f1f8; color: #0a66c2; }
.sch-plat-x         { background: #eef0f2; color: #10141b; }
.sch-plat-tiktok    { background: #eef0f2; color: #10141b; }
.sch-plat-youtube   { background: #fdecec; color: #dc2626; }
.sch-plat-threads   { background: #eef0f2; color: #10141b; }
.sch-plat-pinterest { background: #fdecec; color: #bd081c; }
.sch-plat-stories   { background: #f3ecfd; color: #7c3aed; }
.sch-plat-other     { background: #f1f5f9; color: #475569; }

/* handle + integration cells */
.sch-handle { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--text-secondary, #444); }
.sch-integration { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sch-integration-nm { font-weight: 600; color: var(--text-primary, #1a1a1a); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.sch-integration-id { font-size: 10.5px; color: #94a3b8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.sch-integration-missing { font-size: 11.5px; color: #b45309; font-weight: 600; }

/* state pill */
.sch-state {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.sch-state-dot { width: 6px; height: 6px; border-radius: 999px; flex-shrink: 0; }
.sch-state-connected { background: #dcfce7; color: #15803d; }
.sch-state-connected .sch-state-dot { background: #16a34a; }
.sch-state-expired { background: #fee2e2; color: #b91c1c; }
.sch-state-expired .sch-state-dot { background: #dc2626; }
.sch-state-revoked { background: #e2e8f0; color: #1e293b; }
.sch-state-revoked .sch-state-dot { background: #475569; }
.sch-state-unlinked { background: #f1f5f9; color: #475569; }
.sch-state-unlinked .sch-state-dot { background: #94a3b8; }

.sch-blocks-note { display: block; margin-top: 3px; font-size: 10.5px; font-weight: 700; color: #b91c1c; }

/* last error */
.sch-err { color: #b91c1c; font-size: 11.5px; line-height: 1.4; max-width: 260px; display: block; }
.sch-err-none { color: #cbd5e1; }

/* ── link-integration popover ────────────────────────────────────────────── */
.sch-pop {
  position: absolute; z-index: 60; width: 300px; max-width: 92vw;
  background: #fff; border: 1px solid var(--border-color, #e5e7eb); border-radius: 12px;
  padding: 12px; box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
}
.sch-pop-hd { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #666); font-weight: 700; margin-bottom: 8px; }
.sch-pop-list { display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow-y: auto; }
.sch-pop-item {
  display: flex; align-items: center; gap: 8px; text-align: left;
  border: 0; background: none; border-radius: 8px; padding: 8px 9px;
  font: inherit; font-size: 13px; cursor: pointer; color: var(--text-primary, #1a1a1a); width: 100%;
}
.sch-pop-item:hover { background: #f1f5f9; }
.sch-pop-item:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
.sch-pop-item.is-taken { opacity: .5; cursor: default; }
.sch-pop-item.is-taken:hover { background: none; }
.sch-pop-nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sch-pop-taken { font-size: 10px; font-weight: 700; color: #b45309; white-space: nowrap; }
.sch-pop-empty { font-size: 12px; color: var(--text-muted, #666); padding: 8px 9px; line-height: 1.5; }

/* ── modal (add channel) — layered over the shared .confirm-modal chrome ─── */
.sch-modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, .42);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.sch-modal {
  background: #fff; border-radius: 16px; width: 440px; max-width: 100%;
  max-height: 88vh; overflow-y: auto; padding: 22px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
}
.sch-modal-title { font-size: 17px; font-weight: 700; color: var(--text-primary, #1a1a1a); margin: 0 0 4px; }
.sch-modal-sub { font-size: 12.5px; color: var(--text-muted, #666); line-height: 1.5; margin-bottom: 16px; }
.sch-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.sch-flabel { font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted, #666); font-weight: 700; }
.sch-input {
  width: 100%; box-sizing: border-box; padding: 8px 10px;
  border: 1px solid var(--border-color, #d1d5db); border-radius: 8px;
  font: inherit; font-size: 13px; background: #fff; color: var(--text-primary, #1a1a1a);
}
.sch-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.sch-modal-actions { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.sch-modal-msg { margin-right: auto; font-size: 12px; font-weight: 600; }
.sch-modal-msg.err { color: #dc2626; }
.sch-modal-msg.ok { color: #16a34a; }

/* ── publishing halted ───────────────────────────────────────────────────── */
/* Zero connected channels means nothing has ever published. That is a stopped
   pipeline, not an empty list, so it gets the darkest surface on the page and
   sits above the counters rather than below them. */
.sch-halt {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  padding: 22px 24px; border-radius: 16px;
  background: #1b0f11; border: 1px solid #7f1d1d;
  box-shadow: inset 3px 0 0 #dc2626;
  color: #fde8e8;
}
.sch-halt-hd { display: flex; flex-direction: column; gap: 7px; }
.sch-halt-tag {
  align-self: flex-start;
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em;
  padding: 4px 10px; border-radius: 999px; background: #dc2626; color: #fff;
}
.sch-halt-t { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.3; color: #fff; letter-spacing: -0.01em; }
.sch-halt-b { font-size: 13px; line-height: 1.6; color: #f4cfcf; max-width: 82ch; }
.sch-halt-steps-t {
  margin-top: 4px;
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: #fca5a5;
}
.sch-halt .sch-notice-steps li { color: #f4cfcf; }
.sch-halt .sch-btn {
  background: #fff; border-color: #fff; color: #1b0f11;
}
.sch-halt .sch-btn:hover { background: #fee2e2; border-color: #fee2e2; }

/* ── flash + states ──────────────────────────────────────────────────────── */
.sch-flash {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  border-radius: 11px; padding: 11px 14px; font-size: 13px;
}
.sch-flash-t { font-weight: 600; line-height: 1.45; }
/* The server's own words, kept readable rather than squeezed into one line. */
.sch-flash-d { font-weight: 400; line-height: 1.5; overflow-wrap: anywhere; }
.sch-flash-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.sch-flash-ok { background: #e7f6ec; border: 1px solid #b7e3c6; color: #166534; }
.sch-flash-err { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; }
/* The unverified-link escape hatch. Quieter than the safe fix beside it, on
   purpose: it should never be the button the eye lands on first. */
.sch-btn-ghost {
  background: transparent; border-color: transparent; color: #7f1d1d;
  text-decoration: underline; text-underline-offset: 2px;
}
.sch-btn-ghost:hover { background: rgba(185, 28, 28, .07); border-color: transparent; }
.sch-loading, .sch-empty { padding: 22px 4px; font-size: 13px; color: var(--text-muted, #666); }
.sch-empty-card {
  border: 1px dashed #cbd5e1; border-radius: 14px; background: #fcfdff;
  padding: 26px 22px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
}
.sch-empty-title { font-size: 15px; font-weight: 700; color: var(--text-primary, #1a1a1a); }
.sch-empty-body { font-size: 13px; color: var(--text-secondary, #444); line-height: 1.55; max-width: 78ch; }
.sch-error { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 22px; }
.sch-error-msg { font-size: 13.5px; color: #b91c1c; }

.sch-spin {
  width: 13px; height: 13px; border-radius: 999px;
  border: 2px solid rgba(255,255,255,.45); border-top-color: #fff;
  display: inline-block; animation: sch-spin .7s linear infinite;
}
.sch-btn:not(.sch-btn-primary) .sch-spin { border-color: #dbeafe; border-top-color: #2563eb; }
@keyframes sch-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .sch-spin { animation-duration: 2.4s; }
  .sch-btn, .sch-search-input, .sch-input { transition: none; }
}

/* ── responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1040px) {
  .sch-cmd-vitals { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  /* flex:1 gives the vitals a flex-basis of 0, so without an explicit 100%
     basis they stay squashed on the same row as the big figure instead of
     wrapping under it, and the four boxes overlap each other. */
  .sch-cmd-vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 1 1 100%; }
  .sch-cmd-lead { min-width: 0; flex: 1 1 100%; }
  .sch-head-actions { margin-left: 0; width: 100%; }
}
@media (max-width: 620px) {
  .sch-page { padding: 14px; gap: 14px; }
  .sch-title { font-size: 19px; }
  .sch-cmd { padding: 16px 18px; gap: 18px; }
  .sch-cmd-num { font-size: 38px; }
  .sch-cmd-lead { min-width: 0; }
  .sch-bar { gap: 8px; }
  .sch-select { max-width: 100%; flex: 1 1 140px; }
  .sch-modal { padding: 18px; border-radius: 14px; }
  .sch-halt { padding: 18px 16px; border-radius: 14px; }
  .sch-halt-t { font-size: 17px; }
  .sch-halt .sch-btn { width: 100%; justify-content: center; }
  /* Row actions stack rather than overflowing the table cell. */
  .sch-td-act { white-space: normal; }
}

/* ── #134 dark mode overrides ─────────────────────────────── */
/* The .sch-cmd command strip, the .sch-vital boxes and the .sch-halt banner are
   already dark surfaces in light mode, so they are deliberately left alone. */

/* buttons */
html[data-theme="dark"] .sch-btn:hover { background: #334155; border-color: #475569; }
html[data-theme="dark"] .sch-btn:focus-visible { outline-color: #60a5fa; }
html[data-theme="dark"] .sch-btn-danger { color: #fca5a5; border-color: rgba(248, 113, 113, 0.34); }
html[data-theme="dark"] .sch-btn-danger:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(248, 113, 113, 0.52);
}

/* notice cards */
html[data-theme="dark"] .sch-notice-warn {
  border-color: rgba(245, 158, 11, 0.38);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.10), #1e293b);
}
html[data-theme="dark"] .sch-notice-info {
  border-color: rgba(96, 165, 250, 0.34);
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.10), #1e293b);
}
html[data-theme="dark"] .sch-notice-warn .sch-notice-tag {
  background: rgba(245, 158, 11, 0.20); color: #fcd34d;
}
html[data-theme="dark"] .sch-notice-info .sch-notice-tag {
  background: rgba(59, 130, 246, 0.20); color: #93c5fd;
}
html[data-theme="dark"] .sch-notice-steps code {
  background: rgba(148, 163, 184, 0.16); color: #cbd5e1;
}

/* filter bar */
html[data-theme="dark"] .sch-search-input,
html[data-theme="dark"] .sch-select { background: #0f172a; }
html[data-theme="dark"] .sch-search-input::placeholder { color: #64748b; }
html[data-theme="dark"] .sch-search-input:focus,
html[data-theme="dark"] .sch-select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}
html[data-theme="dark"] .sch-chip { background: #1e293b; }
html[data-theme="dark"] .sch-chip:hover { border-color: #475569; background: #334155; }
/* Light mode marks the active chip with the near-black strip colour; on a dark
   page that reads as "off", so the pill inverts to a light slab instead. */
html[data-theme="dark"] .sch-chip.active {
  background: #e2e8f0; border-color: #e2e8f0; color: #0f172a;
}
html[data-theme="dark"] .sch-chip:focus-visible { outline-color: #60a5fa; }

/* table */
html[data-theme="dark"] .sch-tablewrap { background: #1e293b; }
html[data-theme="dark"] .sch-table { background: transparent; }
html[data-theme="dark"] .sch-table th { background: #273449; }
html[data-theme="dark"] .sch-table tbody tr:hover td { background: #273449; }
html[data-theme="dark"] .sch-table tr.sch-row-blocked td { background: rgba(239, 68, 68, 0.10); }
html[data-theme="dark"] .sch-table tr.sch-row-blocked:hover td { background: rgba(239, 68, 68, 0.16); }
html[data-theme="dark"] .sch-table tr.sch-row-blocked td:first-child { box-shadow: inset 3px 0 0 #f87171; }
html[data-theme="dark"] .sch-table tr.sch-row-dead td:first-child { box-shadow: inset 3px 0 0 #94a3b8; }

/* platform icon cells — each keeps its brand hue, tinted and lightened */
html[data-theme="dark"] .sch-plat-facebook  { background: rgba(24, 119, 242, 0.20); color: #7cb0f7; }
html[data-theme="dark"] .sch-plat-instagram { background: rgba(193, 53, 132, 0.22); color: #f0a0c8; }
html[data-theme="dark"] .sch-plat-linkedin  { background: rgba(10, 102, 194, 0.22); color: #79b8ec; }
html[data-theme="dark"] .sch-plat-x,
html[data-theme="dark"] .sch-plat-tiktok,
html[data-theme="dark"] .sch-plat-threads   { background: rgba(148, 163, 184, 0.18); color: #e2e8f0; }
html[data-theme="dark"] .sch-plat-youtube   { background: rgba(220, 38, 38, 0.20); color: #fca5a5; }
html[data-theme="dark"] .sch-plat-pinterest { background: rgba(189, 8, 28, 0.22); color: #f3a1a8; }
html[data-theme="dark"] .sch-plat-stories   { background: rgba(124, 58, 237, 0.24); color: #c4b5fd; }
html[data-theme="dark"] .sch-plat-other     { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }

html[data-theme="dark"] .sch-integration-missing { color: #fbbf24; }

/* state pills */
html[data-theme="dark"] .sch-state-connected { background: rgba(34, 197, 94, 0.16); color: #86efac; }
html[data-theme="dark"] .sch-state-connected .sch-state-dot { background: #4ade80; }
html[data-theme="dark"] .sch-state-expired { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
html[data-theme="dark"] .sch-state-expired .sch-state-dot { background: #f87171; }
html[data-theme="dark"] .sch-state-revoked { background: rgba(148, 163, 184, 0.18); color: #e2e8f0; }
html[data-theme="dark"] .sch-state-revoked .sch-state-dot { background: #94a3b8; }
html[data-theme="dark"] .sch-state-unlinked { background: rgba(148, 163, 184, 0.12); color: #94a3b8; }

html[data-theme="dark"] .sch-blocks-note,
html[data-theme="dark"] .sch-err,
html[data-theme="dark"] .sch-error-msg { color: #fca5a5; }
html[data-theme="dark"] .sch-err-none { color: #64748b; }

/* popover */
html[data-theme="dark"] .sch-pop {
  background: #1e293b;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] .sch-pop-item:hover { background: #334155; }
html[data-theme="dark"] .sch-pop-item:focus-visible { outline-color: #60a5fa; }
html[data-theme="dark"] .sch-pop-taken { color: #fbbf24; }

/* modal */
html[data-theme="dark"] .sch-modal-backdrop { background: rgba(0, 0, 0, 0.62); }
html[data-theme="dark"] .sch-modal {
  background: #1e293b;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] .sch-input { background: #0f172a; }
html[data-theme="dark"] .sch-input::placeholder { color: #64748b; }
html[data-theme="dark"] .sch-input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}
html[data-theme="dark"] .sch-modal-msg.err { color: #fca5a5; }
html[data-theme="dark"] .sch-modal-msg.ok { color: #86efac; }

/* flash + states */
html[data-theme="dark"] .sch-flash-ok {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(74, 222, 128, 0.36);
  color: #86efac;
}
html[data-theme="dark"] .sch-flash-err {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(248, 113, 113, 0.38);
  color: #fca5a5;
}
html[data-theme="dark"] .sch-btn-ghost { color: #fca5a5; }
html[data-theme="dark"] .sch-btn-ghost:hover {
  background: rgba(248, 113, 113, 0.14);
  border-color: transparent;
}
html[data-theme="dark"] .sch-empty-card {
  border-color: rgba(148, 163, 184, 0.26);
  background: #1e293b;
}
html[data-theme="dark"] .sch-btn:not(.sch-btn-primary) .sch-spin {
  border-color: rgba(96, 165, 250, 0.30);
  border-top-color: #60a5fa;
}
