/* Credits, Data Plan and per-record enrichment (1.27.0): Data credits page, "Add birth month/year" dialog, the lead's
   birth line and the admin Credits & data tab. Class prefix cr- (plus the spec's .lead-born).
   CSP is style-src 'self': no inline style attributes anywhere in the credits markup; progress uses <progress>. */

/* Data credits page */
.cr-head h2 { margin-bottom: 4px; }
.cr-head .notice, .cr-head .form-error { margin: 12px 0 0; }
.cr-readonly { margin: 10px 0 0; font-weight: 600; }
.cr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.cr-card h3 { margin-bottom: 8px; }
.cr-available { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 2px 0 6px; }
.cr-available span { font-weight: 700; color: var(--muted); }
.cr-available strong { font-size: 36px; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.cr-rows { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 0; }
.cr-rows li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.cr-rows li strong { font-variant-numeric: tabular-nums; }
.cr-rows li > span:first-child { flex: 1 1 auto; }
.cr-verify { flex-basis: 100%; color: #8a5a00; font-size: 14px; }
.cr-alert { margin: 12px 0 0; border-radius: 10px; padding: 11px 13px; background: #fff6e5; border: 1px solid #f0c36d; color: #7a4d00; font-weight: 600; }
.cr-small { font-size: 13px; margin: 10px 0 0; }
.cr-plan-status p { margin: 0 0 6px; font-weight: 600; }
.cr-plan-offer { display: grid; gap: 10px; margin-top: 6px; }
.cr-plan-offer p { margin: 0; }
.cr-terms { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #f8fafc; font-size: 13px; line-height: 1.55; }
.cr-terms:focus { outline: 2px solid var(--blue); outline-offset: 2px; }
.cr-terms p { margin: 0 0 8px; }
.cr-terms ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.cr-accept { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; }
.cr-accept input { width: auto; margin-top: 4px; flex-shrink: 0; }
.cr-actions { flex-wrap: wrap; margin-top: 12px; }
.cr-confirm { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff8f7; }
.cr-confirm p { margin: 0 0 10px; }

/* Add funds */
#crTopupForm { display: grid; gap: 12px; }
#crTopupForm h3 { margin: 0; }
#crTopupForm .eyebrow { margin: 0; }
.cr-amount { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
.cr-amount legend { font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; padding: 0; }
.cr-presets label { position: relative; }
.cr-presets input { left: 0; top: 0; width: 1px; height: 1px; }
.cr-presets input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.cr-presets span { min-width: 64px; text-align: center; font-weight: 700; }
.cr-other { display: grid; gap: 6px; font-weight: 650; max-width: 220px; }
.cr-dollar { display: flex; align-items: center; gap: 6px; }
.cr-dollar span { font-weight: 800; color: var(--muted); }
.cr-issue { color: var(--danger); font-weight: 600; }
#crTopupSubmit { justify-self: start; }

/* Statement */
.cr-statement-head { flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.cr-statement-tools { flex-wrap: wrap; align-items: flex-end; }
.cr-inline { display: grid; gap: 4px; font-size: 12px; font-weight: 700; }
.cr-inline input { width: auto; }
.cr-inline-check { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; }
.cr-inline-check input { width: auto; }
.cr-table td, .cr-table th { vertical-align: top; }
.cr-num { text-align: right; font-variant-numeric: tabular-nums; }
th.cr-num { text-align: right; }
.cr-wrap { white-space: normal; min-width: 220px; }
.cr-total td { border-top: 2px solid var(--ink); }

/* Campaign action and dialog */
.cr-enrich-button { border-color: #7c3aed; color: #5b21b6; white-space: nowrap; }
.cr-enrich-button:hover { background: #f5f0ff; border-color: #6d28d9; }
.cr-dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 40px); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 24px 80px rgba(16,33,59,.3); }
.cr-dialog::backdrop { background: rgba(9,20,37,.58); }
.cr-dialog-shell { padding: 24px; overflow: auto; max-height: calc(100vh - 40px); }
.cr-dialog-head { align-items: flex-start; }
.cr-dialog h2 { margin: 0 0 2px; }
.cr-pane { display: grid; gap: 10px; margin-top: 8px; }
.cr-pane h3 { margin: 0; }
.cr-pane p { margin: 0; }
.cr-pane .row.end { flex-wrap: wrap; margin-top: 6px; }
#enrichQuoteBody { display: grid; gap: 8px; }
#enrichQuoteBody p { margin: 0; }
.cr-reasons summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.cr-reasons ul { margin: 6px 0 0; padding-left: 20px; }
.cr-compliance { border-left: 4px solid var(--blue); background: #f2f6ff; border-radius: 0 10px 10px 0; padding: 10px 12px; font-size: 14px; }
.cr-progress { width: 100%; height: 14px; accent-color: var(--blue); }
.cr-progress-text, .cr-result { font-weight: 700; font-size: 16px; }

/* Lead workspace birth line */
.lead-born { margin: 4px 0 10px; font-weight: 700; }
.lead-born small { font-weight: 500; }
.cr-remove-birth { margin: -4px 0 12px; padding: 4px 10px; font-size: 12px; font-weight: 600; border-radius: 999px; }

/* Help */
.cr-help-note { border-left: 4px solid var(--blue); background: #f2f6ff; border-radius: 0 10px 10px 0; padding: 10px 12px; }
.cr-help-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* Admin: Credits & data */
.cr-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 14px 0; }
.cr-stat strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.cr-minimum { font-weight: 700; }
.cr-minimum[data-tone="good"] { color: #176b37; }
.cr-minimum[data-tone="bad"] { color: #a4472b; }
.cr-subform { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 16px; }
.cr-subform h4 { margin: 0 0 8px; font-size: 15px; }
.cr-subform .row.end { margin-top: 10px; }
.cr-subform .form-error { margin-top: 8px; }
.cr-block { display: grid; gap: 6px; margin: 12px 0 0; font-size: 12px; font-weight: 700; }
.cr-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.cr-fieldset[disabled] { opacity: .6; }
.cr-approval { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; margin: 12px 0 0; display: grid; gap: 4px; min-width: 0; }
.cr-approval legend { font-size: 12px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); padding: 0 4px; }
.cr-approval label:not(.check-row) { display: grid; gap: 4px; font-size: 12px; font-weight: 700; }
.cr-product-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 14px; padding: 10px 0; border-top: 1px dashed var(--line); }
.cr-product-row:first-of-type { border-top: 0; }
.cr-product-row > strong { flex: 1 1 140px; align-self: center; }
.cr-product-row label:not(.check-row) { display: grid; gap: 4px; font-size: 12px; font-weight: 700; max-width: 240px; }
.cr-product-row .check-row { display: flex; gap: 8px; align-items: center; margin: 0; }
.cr-product-row .form-error { flex-basis: 100%; }
.cr-subform .check-row, .cr-approval .check-row { display: flex; gap: 8px; align-items: flex-start; }
.cr-subform .check-row input, .cr-approval .check-row input { width: auto; margin-top: 4px; flex-shrink: 0; }
.cr-warnings { margin: 10px 0 0; padding: 10px 14px 10px 30px; border-radius: 10px; background: #fff6e5; color: #7a4d00; font-weight: 600; }
.cr-small-table td, .cr-small-table th { padding: 8px; font-size: 13px; }
.cr-big-line { font-size: 20px; font-weight: 800; margin: 6px 0; }
.cr-big-line[data-tone="good"] { color: #176b37; }
.cr-big-line[data-tone="warn"] { color: #a4472b; }
.cr-ok { color: #176b37; font-weight: 700; }
.cr-mismatch { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.cr-result-tag { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 700; background: #f1f5f9; color: #475569; }
.cr-result-tag[data-result="applied"] { background: #e9f7ee; color: #176b37; }
.cr-result-tag[data-result="unmatched"], .cr-result-tag[data-result="rejected"] { background: #fff0f0; color: #a61b1b; }
#crDeletionResult { margin-top: 14px; }
#crDeletionResult.cr-bad { background: #fff0f0; color: #a61b1b; }
#crAdminEditor .notice { margin: 10px 0 0; }

@media (max-width: 1000px) {
  .cr-grid { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .cr-available strong { font-size: 30px; }
  .cr-dialog { width: 100%; max-width: 100%; max-height: 100%; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .cr-dialog-shell { max-height: 92vh; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); }
  .cr-pane .row.end button { flex: 1 1 auto; }
  .cr-statement-tools { width: 100%; }
  .cr-product-row label:not(.check-row) { max-width: none; flex: 1 1 100%; }
}
