.crm_audit_tabs { display: flex; gap: 6px; padding: 5px; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--light-gray); }
.crm_audit_header_actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.crm_audit_header_actions button { width: auto; }
.crm_audit_date_bar { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--bg); }
.crm_audit_date_bar label { display: grid; gap: 5px; min-width: 280px; color: var(--text-muted); font-size: 13px; font-weight: 700; }
.crm_audit_date_bar select { width: 100%; min-height: 42px; color: var(--text); background: var(--bg); }
.crm_audit_date_bar small { color: var(--text-muted); text-align: right; }
.crm_audit_tabs button { width: auto; min-width: max-content; padding: 9px 13px; border-radius: 8px; background: transparent; color: var(--text-muted); }
.crm_audit_tabs button.active { background: var(--bg); color: var(--brand); box-shadow: 0 1px 4px rgba(17, 24, 39, .12); }
.crm_audit_summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.crm_audit_metric { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.crm_audit_metric span { display: block; color: var(--text-muted); font-size: 13px; }
.crm_audit_metric strong { display: block; margin-top: 4px; color: var(--brand); font-size: 26px; }
.crm_audit_metric.warning { border-color: #e4b453; background: #fff9ec; }
.crm_audit_metric.critical { border-color: rgba(126, 0, 0, .35); background: #fff3f3; }
.crm_audit_metric.critical strong { color: var(--red); }
.crm_audit_metric.ok { border-color: rgba(20, 130, 75, .35); background: #eefaf3; }
.crm_audit_metric.ok strong { color: var(--green); }
.crm_audit_shadow { margin-bottom: 14px; padding: 10px 12px; border-radius: 9px; color: #704800; background: #fff2c7; font-weight: 700; }
.crm_audit_checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-bottom: 14px; }
.crm_audit_check { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 62px; padding: 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text-muted); text-align: left; }
.crm_audit_check_code { padding: 5px 7px; border-radius: 7px; background: var(--light-gray); color: var(--brand); font-weight: 800; }
.crm_audit_check small { line-height: 1.25; }
.crm_audit_check strong { color: var(--brand); font-size: 18px; }
.crm_audit_centers, .crm_audit_findings { display: grid; gap: 10px; }
.crm_audit_center { padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.crm_audit_center > div { display: flex; justify-content: space-between; gap: 12px; }
.crm_audit_center small { display: block; margin-top: 5px; color: var(--text-muted); }
.crm_audit_center.failed { border-color: rgba(126, 0, 0, .35); }
.crm_audit_filters { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)) minmax(170px, 2fr) minmax(180px, 1.4fr) auto auto; gap: 8px; margin-bottom: 10px; }
.crm_audit_filters select, .crm_audit_filters input { width: 100%; min-height: 40px; }
.crm_audit_filters button { width: auto; }
.crm_audit_finding { padding: 14px; border: 1px solid var(--border); border-left: 5px solid var(--brand); border-radius: 11px; background: var(--bg); }
.crm_audit_finding.warning { border-left-color: #d79712; }
.crm_audit_finding.critical { border-left-color: var(--red); }
.crm_audit_finding_head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.crm_audit_finding_head > div { display: flex; align-items: center; gap: 8px; }
.crm_audit_code { padding: 4px 7px; border-radius: 7px; background: var(--light-gray); color: var(--brand); font-weight: 800; }
.crm_audit_state { padding: 5px 8px; border-radius: 999px; background: var(--light-gray); font-size: 12px; font-weight: 700; white-space: nowrap; }
.crm_audit_state.resolved { color: var(--green); background: #e8f7ee; }
.crm_audit_state.confirmed { color: #7a3e00; background: #fff0d8; }
.crm_audit_state.ignored { color: var(--text-muted); }
.crm_audit_meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-muted); font-size: 13px; }
.crm_audit_order_dates { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; color: var(--text-muted); font-size: 13px; }
.crm_audit_comment { padding: 8px 10px; border-radius: 8px; background: var(--light-gray); }
.crm_audit_actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.crm_audit_actions a, .crm_audit_actions button { width: auto; padding: 8px 10px; font-size: 13px; }
.crm_audit_empty { display: grid; gap: 5px; padding: 25px; border: 1px dashed var(--border); border-radius: 12px; color: var(--text-muted); text-align: center; }
.crm_manual_head { margin-top: 14px; }
.crm_audit_details_modal { max-width: 720px; }
.crm_audit_staff { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 16px; padding: 10px; border-radius: 9px; background: var(--light-gray); }
.crm_audit_works { display: grid; gap: 8px; }
.crm_audit_work { display: grid; gap: 5px; padding: 10px; border: 1px solid var(--border); border-radius: 9px; }
.crm_audit_work > span { color: var(--text-muted); font-size: 13px; }
.crm_audit_work > div { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.crm_audit_match_list { display: grid; gap: 7px; margin: 10px 0; }
.crm_audit_match_list > div { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(130px, 1fr) auto; gap: 8px; padding: 9px; border-radius: 8px; background: var(--light-gray); }
.crm_audit_match_list em { font-style: normal; font-weight: 700; }
.crm_audit_match_list em.matched, .crm_audit_match_list em.return_completed { color: var(--green); }
.crm_audit_match_list em.return_pending { color: #9a6500; }
.crm_audit_match_list em.return_rejected, .crm_audit_match_list em.amount_mismatch, .crm_audit_match_list em.missing { color: var(--red); }
.crm_audit_purchase_summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.crm_audit_purchase_filters { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) minmax(190px, 2fr) minmax(180px, 1.4fr) auto auto; gap: 8px; margin-bottom: 10px; }
.crm_audit_purchase_filters select, .crm_audit_purchase_filters input { width: 100%; min-height: 40px; }
.crm_audit_purchase_filters button { width: auto; }
.crm_audit_purchase_list { display: grid; gap: 10px; }
.crm_audit_purchase { padding: 14px; border: 1px solid var(--border); border-left: 5px solid var(--green); border-radius: 11px; background: var(--bg); }
.crm_audit_purchase.not_ok { border-left-color: var(--red); }
.crm_audit_purchase.warning { border-left-color: #d79712; }
.crm_audit_purchase.neutral { border-left-color: var(--text-muted); }
.crm_audit_purchase_head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.crm_audit_purchase_head > div { display: grid; gap: 4px; }
.crm_audit_purchase_head > div span { color: var(--text-muted); font-size: 13px; }
.crm_audit_result { padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.crm_audit_result.ok { color: var(--green); background: #e8f7ee; }
.crm_audit_result.not_ok { color: var(--red); background: #fff0f0; }
.crm_audit_result.warning { color: #7a4b00; background: #fff0d8; }
.crm_audit_result.neutral { color: var(--text-muted); background: var(--light-gray); }
.crm_audit_purchase_amounts { display: flex; flex-wrap: wrap; gap: 7px 18px; margin-top: 12px; }
.crm_audit_purchase_note { margin: 8px 0; padding: 8px 10px; border-radius: 8px; color: #704800; background: #fff2c7; }
.crm_audit_request_link { width: auto; padding: 0; border: 0; color: var(--brand); background: transparent; font: inherit; font-weight: 800; text-align: left; text-decoration: underline; cursor: pointer; }
.crm_audit_purchase > p { margin-bottom: 0; color: var(--text-muted); }
.crm_audit_pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.crm_audit_pager button { width: auto; }

@media (max-width: 760px) {
  .crm_audit_header_actions { width: 100%; }
  .crm_audit_header_actions button { flex: 1 1 160px; }
  .crm_audit_date_bar { display: grid; align-items: stretch; }
  .crm_audit_date_bar label { min-width: 0; }
  .crm_audit_date_bar small { text-align: left; }
  .crm_audit_summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crm_audit_purchase_summary { grid-template-columns: 1fr; }
  .crm_audit_purchase_filters { grid-template-columns: 1fr; }
  .crm_audit_purchase_filters button { width: 100%; }
  .crm_audit_purchase_head { display: grid; }
  .crm_audit_result { justify-self: start; }
  .crm_audit_checks { grid-template-columns: 1fr; }
  .crm_audit_filters { grid-template-columns: 1fr; }
  .crm_audit_filters button { width: 100%; }
  .crm_audit_finding_head { display: grid; }
  .crm_audit_state { justify-self: start; }
  .crm_audit_match_list > div { grid-template-columns: 1fr; }
  .crm_audit_staff { grid-template-columns: 1fr; }
}
