/* ============================================================================
   Client Brain → Reporting tab — isolated stylesheet for the digest card
   and Reporting sidebar mobile breakpoints.
   ----------------------------------------------------------------------------
   Loaded via <link> at the very end of <body> in base.html AFTER
   editorial-final.css. Pattern matches cm-images-tab.css.

   Two things live here:
     1. .dgst-* — weekly-digest sidebar card (toggle + picker + test btn)
     2. Mobile rules for .rpt-shell / .rpt-rail (the Reporting tab layout
        was a fixed 2-column grid with no breakpoint and stacked off-screen
        on phones)
   ========================================================================== */

/* ── Weekly digest card ────────────────────────────────────────────── */
html body .dgst-card { font-family: inherit; }
html body .dgst-card * { box-sizing: border-box; }

/* ── iOS-style toggle ──────────────────────────────────────────────── */
html body .dgst-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  background: var(--cm-border, #d9d4c4);
  border: 1px solid var(--cm-border, #d9d4c4);
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s ease;
  padding: 0;
  outline: none;
}
html body .dgst-toggle:focus-visible {
  box-shadow: 0 0 0 3px rgba(244,225,74,0.4);
}
html body .dgst-toggle:disabled { opacity: 0.55; cursor: wait; }
html body .dgst-toggle .dgst-toggle-knob {
  position: absolute;
  top: 1px; left: 1px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  transition: transform .18s ease;
}
html body .dgst-toggle.is-on {
  background: var(--accent, #f4e14a);
  border-color: var(--accent, #f4e14a);
}
html body .dgst-toggle.is-on .dgst-toggle-knob {
  transform: translateX(20px);
}

/* ── Buttons inside the digest card ────────────────────────────────── */
html body .dgst-card .dgst-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--cm-border, #d9d4c4);
  border-radius: 6px;
  color: var(--cm-text, #0a0a0a);
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  line-height: 1; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
html body .dgst-card .dgst-btn:hover {
  border-color: var(--cm-text, #0a0a0a);
}
html body .dgst-card .dgst-btn:disabled {
  opacity: 0.55; cursor: not-allowed;
}
html body .dgst-card .dgst-btn-primary {
  background: var(--accent, #f4e14a);
  border-color: var(--accent, #f4e14a);
  color: var(--accent-ink, #0a0a0a);
  width: 100%;
  justify-content: center;
  padding: 10px 14px;
}
html body .dgst-card .dgst-btn-primary:hover {
  background: var(--accent-hover, #e4cc00);
  border-color: var(--accent-hover, #e4cc00);
}
html body .dgst-card .dgst-btn-ghost {
  background: transparent;
}

/* ── Channel picker ────────────────────────────────────────────────── */
html body .dgst-card .dgst-search {
  flex: 1; min-width: 0;
  padding: 8px 11px;
  font-family: inherit;
  font-size: 0.82rem;
  border: 1px solid var(--cm-border, #d9d4c4);
  background: var(--cm-surface, #fbfaf6);
  color: var(--cm-text, #0a0a0a);
  border-radius: 6px;
  outline: none;
}
html body .dgst-card .dgst-search:focus {
  border-color: var(--accent, #f4e14a);
  box-shadow: 0 0 0 3px rgba(244,225,74,0.22);
}
html body .dgst-card .dgst-picker-row {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 8px 11px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--cm-border, #d9d4c4);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--cm-text, #0a0a0a);
  transition: background .12s;
}
html body .dgst-card .dgst-picker-row:last-child { border-bottom: none; }
html body .dgst-card .dgst-picker-row:hover {
  background: var(--cm-surface2, #f4f1e8);
}
html body .dgst-card .dgst-priv-pill {
  display: inline-block;
  padding: 2px 7px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 8.5px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--cm-surface2, #f4f1e8);
  color: var(--cm-text-dim, #5d5d5a);
  border-radius: 999px;
}

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE — Reporting tab layout
   The .rpt-shell was a fixed 2-col grid (`minmax(0,1fr) 300px`) inlined
   on the template. Below 880px the 300px sidebar squeezed the main
   column unreadably; below 640px both columns got crushed. Stack at 880.
   ════════════════════════════════════════════════════════════════════ */

@media (max-width: 880px) {
  html body .rpt-shell {
    grid-template-columns: 1fr !important;
    padding: 1rem !important;
    gap: 14px !important;
  }
  html body .rpt-rail > div {
    position: static !important;  /* drop the sticky on mobile */
  }
}

@media (max-width: 560px) {
  html body .rpt-shell {
    padding: 0.75rem !important;
  }
  /* Stretch the digest action buttons full-width when the rail collapses. */
  html body .dgst-card .dgst-btn-ghost {
    flex: 1; justify-content: center;
  }
  /* Tighter picker list height so the keyboard doesn't push it offscreen. */
  html body .dgst-card .dgst-picker-list {
    max-height: 140px !important;
  }
}

/* Touch: bigger toggle target for finger taps. */
@media (hover: none) {
  html body .dgst-toggle {
    width: 50px; height: 28px;
  }
  html body .dgst-toggle .dgst-toggle-knob {
    width: 24px; height: 24px;
  }
  html body .dgst-toggle.is-on .dgst-toggle-knob {
    transform: translateX(22px);
  }
}

/* ════════════════════════════════════════════════════════════════════════
   Digest channel picker — modal popup variant of .cmov-modal.
   Re-uses the gold-standard shell (head + body + foot) so the picker
   feels like Edit Client + Weekly Score popups, not a one-off inline
   widget. Default backend filter limits to #client-/#project- channels.
   ════════════════════════════════════════════════════════════════════════ */

html body .cm-edit-modal.cmov-modal.cmov-picker-modal {
  max-width: 540px;
  height: auto;
  min-height: 0;
  max-height: 80vh;
  grid-template-rows: auto 1fr auto;
}
html body .cmov-picker-body {
  padding: 16px 20px 6px;
  display: flex; flex-direction: column; gap: 10px;
  overflow: hidden;
  min-height: 0;
}
html body .cmov-picker-searchwrap {
  position: relative;
  display: flex; align-items: center;
}
html body .cmov-picker-searchwrap i {
  position: absolute;
  left: 12px;
  color: var(--ink-faint, #8a8882);
  font-size: 14px;
  pointer-events: none;
}
html body input.cmov-picker-search {
  width: 100%;
  padding: 10px 12px 10px 36px;
  background: #fff;
  color: var(--cm-text, #0a0a0a);
  border: 1px solid var(--cm-border, #d9d4c4);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
html body input.cmov-picker-search:focus {
  border-color: var(--accent, #f4e14a);
  box-shadow: 0 0 0 3px rgba(244, 225, 74, 0.35);
}
html body .cmov-picker-list {
  flex: 1; min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--cm-border, #d9d4c4);
  border-radius: 6px;
  background: #fff;
}
html body button.cmov-picker-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 11px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--cm-border, #d9d4c4);
  font: inherit;
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
html body button.cmov-picker-row:last-child { border-bottom: none; }
html body button.cmov-picker-row:hover {
  background: var(--accent-ghost, #fbf6c4);
}
html body .cmov-picker-row-name {
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.84rem;
  color: var(--ink-strong, #0a0a0a);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html body .cmov-picker-priv {
  padding: 2px 7px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 8.5px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--cm-surface2, #f4f1e8);
  color: var(--ink-muted, #5d5d5a);
  border-radius: 999px;
}
html body .cmov-picker-row-cta {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint, #8a8882);
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: color .12s, background .12s, border-color .12s;
}
html body button.cmov-picker-row:hover .cmov-picker-row-cta {
  color: var(--accent-ink, #0a0a0a);
  background: var(--accent, #f4e14a);
  border-color: var(--accent, #f4e14a);
}
html body .cmov-picker-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--ink-faint, #8a8882);
  font-style: italic;
}
html body .cmov-picker-empty strong {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-style: normal;
  font-weight: 700;
  color: var(--ink-muted, #5d5d5a);
}

/* Mobile: full-screen picker for thumb-friendly use. */
@media (max-width: 560px) {
  html body .cm-edit-modal.cmov-modal.cmov-picker-modal {
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
}
