/* Compassion Fund donations: donate sheet, manager inbox, pay / thank-you page.
   Uses the site theme tokens (styles/main.css) with safe fallbacks. */

.cfd-lock { overflow: hidden; }
.cfd-bg { z-index: 10050; }
.cfd-sheet { position: relative; max-height: 92vh; padding: 1.2rem 1.1rem calc(1.4rem + env(safe-area-inset-bottom)); }
.cfd-wide { max-width: 640px; }
.cfd-sheet:focus { outline: none; }
.cfd-close {
    position: absolute; top: 0.9rem; right: 0.9rem; width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid var(--border-color, rgba(255,255,255,.1)); background: var(--bg-secondary, #1a1a2e);
    color: var(--text-secondary, #a0aec0); font-size: 1rem; cursor: pointer;
}
.cfd-sheet .cz-modal-heading { padding-right: 2.6rem; }
.cfd-body { display: flex; flex-direction: column; gap: 0.9rem; }
.cfd-form { display: flex; flex-direction: column; gap: 0.85rem; }
.cfd-form .cz-field { margin: 0; }
.cfd-label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary, #a0aec0); }
.cfd-label input, .cfd-receive input, .cfd-search input, .cfd-reply {
    width: 100%; box-sizing: border-box; padding: 0.7rem 0.8rem; border-radius: 12px; font: inherit; font-size: 1rem;
    border: 1px solid var(--border-color, rgba(255,255,255,.1)); background: var(--bg-secondary, #1a1a2e); color: var(--text-primary, #fff);
}
.cfd-label input:focus, .cfd-receive input:focus, .cfd-search input:focus { outline: 2px solid #10B981; outline-offset: 1px; }
.cfd-muted { color: var(--text-tertiary, #94a3b8); }
.cfd-small { font-size: 0.8rem; line-height: 1.45; margin: 0; }
.cfd-hi { display: block; margin-top: 0.25rem; opacity: 0.85; }
.cfd-error { margin: 0; padding: 0.6rem 0.8rem; border-radius: 10px; background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.35); color: #fca5a5; font-size: 0.88rem; }
.cfd-empty { text-align: center; padding: 1.4rem 0; color: var(--text-tertiary, #94a3b8); }
.cfd-trap { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

.cfd-note {
    padding: 0.75rem 0.9rem; border-radius: 14px; font-size: 0.86rem; line-height: 1.5; text-align: left;
    background: rgba(16,185,129,.08); border: 1px solid rgba(16,185,129,.25); color: var(--text-secondary, #cbd5e1);
}
.cfd-note-warn { background: rgba(245,158,11,.09); border-color: rgba(245,158,11,.35); }
.cfd-note-safe { background: rgba(14,165,233,.08); border-color: rgba(14,165,233,.3); }

.cfd-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.cfd-chip {
    min-height: 40px; padding: 0.45rem 0.8rem; border-radius: 999px; font: inherit; font-size: 0.86rem; cursor: pointer;
    border: 1px solid var(--border-color, rgba(255,255,255,.12)); background: var(--bg-secondary, #1a1a2e); color: var(--text-primary, #fff);
}
.cfd-chip[aria-checked="true"] { border-color: #10B981; background: rgba(16,185,129,.16); color: #6ee7b7; font-weight: 700; }
.cfd-check { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.86rem; line-height: 1.45; color: var(--text-secondary, #cbd5e1); cursor: pointer; }
.cfd-check input { width: 20px; height: 20px; margin: 1px 0 0; flex-shrink: 0; accent-color: #10B981; }

.cfd-primary, .cfd-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 46px; padding: 0.7rem 1rem;
    border-radius: 14px; font: inherit; font-weight: 700; font-size: 0.98rem; cursor: pointer; text-decoration: none; box-sizing: border-box;
}
.cfd-primary { border: none; color: #fff; background: linear-gradient(135deg, #10B981, #0D9488); box-shadow: 0 6px 18px rgba(16,185,129,.28); }
.cfd-primary:disabled, .cfd-ghost:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.cfd-wa { background: linear-gradient(135deg, #25d366, #128c7e); }
.cfd-ghost { border: 1px solid var(--border-color, rgba(255,255,255,.14)); background: transparent; color: var(--text-primary, #fff); }
/* Beat the theme's [data-theme] a { color } rule for button-styled links. */
[data-theme] a.cfd-primary, [data-theme] a.cfd-primary:visited { color: #fff; }
[data-theme] a.cfd-ghost, [data-theme] a.cfd-ghost:visited { color: var(--text-primary, #fff); }
[data-theme] .cfd-card-links a, [data-theme] .cfd-top a, [data-theme] a.cfd-mine { color: #5EEAD4; }
.cfd-block { width: 100%; }
.cfd-sm { min-height: 38px; padding: 0.45rem 0.75rem; font-size: 0.85rem; border-radius: 11px; }
.cfd-danger { color: #fca5a5; border-color: rgba(239,68,68,.35); }
.cfd-primary:focus-visible, .cfd-ghost:focus-visible, .cfd-chip:focus-visible, .cfd-tab:focus-visible, .cfd-close:focus-visible { outline: 2px solid #5EEAD4; outline-offset: 2px; }

.cfd-done { text-align: center; }
.cfd-done-icon { font-size: 2.4rem; }
.cfd-ref { display: flex; align-items: center; justify-content: center; gap: 0.6rem; flex-wrap: wrap; }
.cfd-ref code {
    font-size: 1.35rem; font-weight: 800; letter-spacing: 0.06em; padding: 0.45rem 0.8rem; border-radius: 12px;
    background: rgba(16,185,129,.12); border: 1px dashed rgba(16,185,129,.5); color: #6ee7b7;
}
.cfd-steps { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.9rem; line-height: 1.5; color: var(--text-secondary, #cbd5e1); }

/* Donate card on the Compassion page */
.cfd-card-note { margin: 0.8rem 0 0; font-size: 0.8rem; line-height: 1.5; color: var(--text-tertiary, #94a3b8); }
.cfd-card-links { margin: 0.45rem 0 0; font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.35rem 0.7rem; justify-content: center; align-items: center; }
.cfd-card-links a, .cfd-mine { color: #5EEAD4; text-decoration: none; font-weight: 600; }
.cfd-card-links a:hover { text-decoration: underline; }
button.cz-donate-btn { border: none; cursor: pointer; font: inherit; width: 100%; }

/* Manager inbox */
.cfd-count {
    display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px;
    border-radius: 999px; background: #ef4444; color: #fff; font-size: 0.72rem; font-weight: 800;
}
.cfd-count[hidden] { display: none; }
.cfd-meter { padding: 0.8rem 0.9rem; border-radius: 14px; background: var(--bg-secondary, #1a1a2e); border: 1px solid var(--border-color, rgba(255,255,255,.08)); display: flex; flex-direction: column; gap: 0.45rem; }
.cfd-meter-top { display: flex; justify-content: space-between; gap: 0.6rem; font-size: 0.86rem; flex-wrap: wrap; }
.cfd-bar { height: 8px; border-radius: 999px; background: rgba(148,163,184,.18); overflow: hidden; }
.cfd-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #10B981, #0EA5E9); }
.cfd-meter.warn .cfd-bar i { background: linear-gradient(90deg, #F59E0B, #EF4444); }
.cfd-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.cfd-tabs { display: flex; gap: 0.3rem; padding: 0.25rem; border-radius: 12px; background: var(--bg-secondary, #1a1a2e); }
.cfd-tab { min-height: 36px; padding: 0.35rem 0.8rem; border-radius: 9px; border: none; background: transparent; color: var(--text-secondary, #a0aec0); font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer; }
.cfd-tab[aria-selected="true"] { background: rgba(16,185,129,.18); color: #6ee7b7; }
.cfd-search { display: flex; gap: 0.5rem; }
.cfd-search input { flex: 1; min-width: 0; font-size: 0.92rem; padding: 0.55rem 0.75rem; }
.cfd-list { display: flex; flex-direction: column; gap: 0.7rem; }
.cfd-card {
    padding: 0.85rem 0.9rem; border-radius: 16px; display: flex; flex-direction: column; gap: 0.35rem;
    background: var(--bg-secondary, #1a1a2e); border: 1px solid var(--border-color, rgba(255,255,255,.08)); border-left: 4px solid #0EA5E9;
}
.cfd-card.s-requested { border-left-color: #F59E0B; }
.cfd-card.s-received { border-left-color: #10B981; }
.cfd-card.s-expired, .cfd-card.s-not_paid { border-left-color: #64748b; opacity: 0.9; }
.cfd-card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.cfd-amt { font-size: 1.15rem; }
.cfd-status { font-size: 0.78rem; font-weight: 700; color: var(--text-secondary, #a0aec0); white-space: nowrap; }
.cfd-card-who { font-weight: 600; font-size: 0.92rem; display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.cfd-pill { font-size: 0.68rem; padding: 0.1rem 0.45rem; border-radius: 999px; background: rgba(14,165,233,.15); color: #7dd3fc; font-weight: 700; }
.cfd-card code { font-size: 0.82em; }
.cfd-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-top: 0.3rem; }
.cfd-receive { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.4rem; padding-top: 0.7rem; border-top: 1px dashed var(--border-color, rgba(255,255,255,.12)); }
.cfd-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.cfd-reply { font-size: 0.88rem; line-height: 1.5; resize: vertical; }

/* Pay / thank-you page */
.cfd-page { min-height: 100vh; margin: 0; background: var(--bg-primary, #0f0f1a); color: var(--text-primary, #fff); font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.cfd-wrap { max-width: 520px; margin: 0 auto; padding: 1.2rem 16px 3rem; display: flex; flex-direction: column; gap: 1rem; }
.cfd-top { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.cfd-top a { color: #5EEAD4; text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.cfd-brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 800; }
.cfd-brand img { width: 40px; height: 40px; border-radius: 12px; }
.cfd-panel { padding: 1.2rem; border-radius: 20px; background: var(--bg-secondary, #1a1a2e); border: 1px solid var(--border-color, rgba(255,255,255,.08)); display: flex; flex-direction: column; gap: 0.9rem; }
.cfd-panel h1 { margin: 0; font-size: 1.35rem; line-height: 1.3; }
.cfd-big { font-size: 2.2rem; font-weight: 800; margin: 0; }
.cfd-qr { align-self: center; padding: 12px; background: #fff; border-radius: 16px; width: 200px; height: 200px; box-sizing: content-box; }
.cfd-qr img, .cfd-qr canvas { width: 200px !important; height: 200px !important; display: block; }
.cfd-kv { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 0.9rem; font-size: 0.9rem; margin: 0; }
.cfd-kv dt { color: var(--text-tertiary, #94a3b8); }
.cfd-kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.cfd-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.cfd-timeline li { display: flex; gap: 0.6rem; align-items: center; font-size: 0.9rem; color: var(--text-tertiary, #94a3b8); }
.cfd-timeline li::before { content: ''; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; flex-shrink: 0; }
.cfd-timeline li.done { color: #6ee7b7; }
.cfd-timeline li.done::before { background: currentColor; }
.cfd-timeline li.now { color: var(--text-primary, #fff); font-weight: 700; }
.cfd-thanks { text-align: center; background: linear-gradient(160deg, rgba(16,185,129,.16), rgba(13,148,136,.06)); border-color: rgba(16,185,129,.35); }
.cfd-lookup { display: flex; gap: 0.5rem; }
.cfd-lookup input { flex: 1; min-width: 0; padding: 0.7rem 0.8rem; border-radius: 12px; font: inherit; font-size: 1rem; text-transform: uppercase;
    border: 1px solid var(--border-color, rgba(255,255,255,.12)); background: var(--bg-primary, #0f0f1a); color: var(--text-primary, #fff); }

@media (max-width: 420px) {
    .cfd-row2 { grid-template-columns: 1fr; }
    .cfd-ref code { font-size: 1.15rem; }
}
@media (prefers-reduced-motion: reduce) {
    .cfd-bg, .cfd-sheet { transition: none !important; }
}
@media print {
    .cfd-top, .cfd-noprint { display: none !important; }
    .cfd-page { background: #fff; color: #000; }
    .cfd-panel { border: 1px solid #ccc; background: #fff; }
}
