/* ChatProof parent screen (#chatproof) and its Requests doorway (#chatproofDoorway).
 *
 * Scoped to those two ids only. Colour carries meaning (UI-DIRECTION §3): this
 * sheet adds NO hue of its own — status colours come from app.css's existing
 * role pills (.pill.on applied/done, .pill.wait waiting, .pill.attn needs
 * attention, .pill.off paused/blocked, .pill.trusted trusted) and the role
 * tokens (--brand, --done-text, --waiting-text, --coral). Everything wraps:
 * 375px must not scroll sideways and large text must not clip, so there are no
 * fixed heights and every long word may break.
 */

#chatproof .cpPanelRoot { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
#chatproof .cpPanelRoot * { min-width: 0; }
#chatproof .cpHead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
#chatproof .cpTitle { font-family: var(--font-heading, var(--ui)); font-size: 1.6rem; line-height: 1.2; margin: 0; color: var(--text-primary, var(--cloud)); }
#chatproof .cpIntro { margin: 0; font-size: .9rem; line-height: 1.45; }
#chatproof .cpH { font-family: var(--font-heading, var(--ui)); font-size: 1.15rem; line-height: 1.3; margin: 0 0 6px; color: var(--text-primary, var(--cloud)); }
#chatproof h3.cpH { font-size: 1rem; }
#chatproof .cpH4 { font-size: .9rem; font-weight: 700; margin: 0 0 4px; color: var(--text-primary, var(--cloud)); }
#chatproof .cpH:focus, #chatproof [tabindex="-1"]:focus { outline: 2px solid var(--brand, var(--glow)); outline-offset: 3px; border-radius: 6px; }

#chatproof .cpSection {
  display: flex; flex-direction: column; gap: 10px;
  padding-top: 12px; border-top: 1px solid var(--border-subtle, var(--line));
}
#chatproof .cpChild, #chatproof .cpContact, #chatproof .cpReport, #chatproof .cpInviteRow {
  border: 1px solid var(--border-subtle, var(--line)); border-radius: var(--radius-control, 14px);
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
  background: var(--surface-raised, transparent);
}
#chatproof .cpRowHead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#chatproof .cpName { font-size: 1rem; line-height: 1.35; overflow-wrap: anywhere; color: var(--text-primary, var(--cloud)); margin-right: auto; }
#chatproof .cpRowHead .pill { white-space: normal; text-align: center; }
#chatproof .help { margin: 0; font-size: .85rem; line-height: 1.45; overflow-wrap: anywhere; }
#chatproof .cpEffective { margin: 0; font-size: .9rem; line-height: 1.4; color: var(--text-primary, var(--cloud)); overflow-wrap: anywhere; }
#chatproof .cpStatus[data-state="applied"] { color: var(--done-text, var(--mint)); }
#chatproof .cpStatus[data-state="pending"] { color: var(--waiting-text, var(--amber)); }

#chatproof .cpDevices, #chatproof .cpCopyList, #chatproof .cpInvites, #chatproof .cpReportList {
  list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px;
}
#chatproof .cpDevice, #chatproof .cpCopy { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
#chatproof .cpDeviceName, #chatproof .cpCopyName { overflow-wrap: anywhere; font-size: .9rem; }

#chatproof fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#chatproof .cpLegend { font-size: .85rem; font-weight: 700; margin-bottom: 4px; color: var(--text-secondary, var(--haze)); padding: 0; }
#chatproof .cpCheck, #chatproof .cpRadio { display: flex; flex-direction: column; gap: 2px; }
#chatproof .cpCheckLabel {
  display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer;
  font-size: .95rem; line-height: 1.35; color: var(--text-primary, var(--cloud));
}
#chatproof .cpCheckLabel input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--brand, var(--glow)); }
#chatproof .cpCheckLabel input:focus-visible { outline: 2px solid var(--brand, var(--glow)); outline-offset: 2px; }
#chatproof .cpCheckLabel input:disabled + span { opacity: .6; }
#chatproof .cpInline { display: inline-flex; margin-right: 16px; }
#chatproof .cpRetention { flex-direction: row; flex-wrap: wrap; }
#chatproof .cpRetention .cpLegend { width: 100%; }
#chatproof .cpReason { font-size: .8rem; line-height: 1.4; color: var(--text-secondary, var(--haze)); padding-left: 30px; overflow-wrap: anywhere; }
#chatproof .cpField { display: flex; flex-direction: column; gap: 4px; }
#chatproof .cpField .inp { margin: 0; }
#chatproof .cpCode, #chatproof .cpCodeInput { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95rem; overflow-wrap: anywhere; }

#chatproof .cpForm { display: flex; flex-direction: column; gap: 12px; }
#chatproof .cpDisclosure {
  border-left: 3px solid var(--brand, var(--glow)); padding: 8px 12px;
  background: var(--brand-tint, transparent); border-radius: 0 10px 10px 0;
}
#chatproof .cpDiscList { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
#chatproof .cpDiscLine { font-size: .85rem; line-height: 1.45; color: var(--text-primary, var(--cloud)); overflow-wrap: anywhere; }
#chatproof .cpAck { font-weight: 700; }

#chatproof .cpActions { display: flex; flex-wrap: wrap; gap: 8px; }
#chatproof .chip { white-space: normal; text-align: center; line-height: 1.3; max-width: 100%; }
#chatproof .chip:focus-visible, #chatproofDoorway .chip:focus-visible { outline: 2px solid var(--brand, var(--glow)); outline-offset: 2px; }
#chatproof .cpPrimary { background: var(--brand, var(--glow)); color: var(--primary-cta-text, var(--ink)); border-color: var(--brand, var(--glow)); }
#chatproof .cpDanger { color: var(--coral); border-color: rgba(255,107,94,.45); }
:root[data-theme="light"] #chatproof .cpDanger { color: #B23127; }
#chatproof .cpSmall { min-height: 40px; padding: 7px 11px; font-size: 12px; align-self: flex-start; }
#chatproof .cpBack { align-self: flex-start; }
#chatproof .chip:disabled { opacity: .6; cursor: default; }

#chatproof .cpOk, #chatproof .cpBad { margin: 0; font-size: .875rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
#chatproof .cpOk { color: var(--done-text, var(--mint)); }
#chatproof .cpOk::before { content: "✓ "; }
#chatproof .cpBad { color: var(--coral); }
:root[data-theme="light"] #chatproof .cpBad { color: #B23127; }
#chatproof .cpBad::before { content: "! "; }

#chatproof .cpPanel {
  border: 1px solid var(--border-control, var(--line)); border-radius: var(--radius-control, 14px);
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
}
#chatproof .cpConfirm {
  border: 1px solid rgba(255,107,94,.45); border-radius: var(--radius-control, 14px);
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
#chatproof .cpConfirmTitle, #chatproof .cpConfirmText { margin: 0; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; color: var(--text-primary, var(--cloud)); }

#chatproof .cpMsgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
#chatproof .cpMsg {
  display: flex; flex-direction: column; gap: 6px; padding: 10px 12px;
  border-radius: 14px; border: 1px solid var(--border-subtle, var(--line)); max-width: 100%;
}
#chatproof .cpMine { border-left: 3px solid var(--brand, var(--glow)); }
#chatproof .cpTheirs { border-left: 3px solid var(--border-control, var(--line)); }
#chatproof .cpMsgMeta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: .8rem; }
#chatproof .cpMsgFrom { color: var(--text-primary, var(--cloud)); }
#chatproof .cpMsgWhen, #chatproof .cpDelivery { color: var(--text-secondary, var(--haze)); font-size: .8rem; }
#chatproof .cpMsgText { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; color: var(--text-primary, var(--cloud)); }
#chatproof .cpMsgDeleted { font-style: italic; color: var(--text-secondary, var(--haze)); }
#chatproof .cpPreset { display: inline-flex; align-items: center; gap: 8px; font-size: 1rem; }
#chatproof .cpPresetPic { font-size: 1.6rem; line-height: 1; }
#chatproof .cpClipLabel { font-size: .9rem; color: var(--text-primary, var(--cloud)); }
#chatproof .cpPlayer { display: block; width: 100%; max-width: 420px; }
#chatproof video.cpPlayer { max-height: 320px; background: #000; border-radius: 10px; }
#chatproof .cpCopies { display: flex; flex-direction: column; gap: 6px; }
#chatproof .cpReportReason { margin: 0; font-weight: 700; color: var(--text-primary, var(--cloud)); }
#chatproof .cpInviteRow { flex-direction: row; flex-wrap: wrap; align-items: center; }
#chatproof .cpInviteCopy { display: flex; flex-direction: column; gap: 2px; flex: 1 1 220px; }

/* The doorway on Requests: the same shape #parenttapLinkCard already has. */
#chatproofDoorway { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
#chatproofDoorway .cpDoorCopy { flex: 1 1 240px; min-width: 0; }
#chatproofDoorway .cpDoorHead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#chatproofDoorway .cpDoorHead .sect { margin-bottom: 4px; flex: 1 1 auto; }
#chatproofDoorway .help { margin: 0; overflow-wrap: anywhere; }
#chatproofDoorway .cpDoorOpen { flex: none; white-space: normal; }

@media (max-width: 420px) {
  #chatproof .cpTitle { font-size: 1.35rem; }
  #chatproof .cpActions > .chip { flex: 1 1 100%; }
  #chatproof .cpSmall { flex: 0 0 auto; }
}
