/* ============================================================
   CSB Heap Design — Patch 6: Bonus Disputes Screen
   ------------------------------------------------------------
   Targets #bonus-dispute-screen (agent + admin bonus dispute UI).
   Pure CSS. The module uses inline styles heavily so we use
   attribute selectors to intercept them.
   ============================================================ */

/* ---------- Black canvas ---------- */
body:has(#bonus-dispute-screen:not(.hidden)) {
  background: #000000 !important;
}

#bonus-dispute-screen {
  background: #000000 !important;
  color: #fafafa !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
}

/* Mint accent strip */
#bonus-dispute-screen::before {
  content: '' !important;
  display: block !important;
  height: 2px !important;
  background: #3ecf8e !important;
  width: 100% !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 200 !important;
  animation: heap-pulse 3s ease-in-out infinite !important;
}

/* ---------- Header ---------- */
#bonus-dispute-screen .app-header {
  background: #000000 !important;
  border-bottom: 1px solid #1a1a1a !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}
#bonus-dispute-screen .app-header-inner {
  padding: 18px 22px 14px !important;
  max-width: none !important;
}
#bonus-dispute-screen .header-title {
  font-family: ui-serif, Georgia, serif !important;
  font-size: 22px !important;
  font-weight: 400 !important;
  letter-spacing: -0.3px !important;
  color: #fafafa !important;
}
#bonus-dispute-screen .header-subtitle {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 10px !important;
  letter-spacing: 1.5px !important;
  text-transform: uppercase !important;
  color: #737373 !important;
}

/* Header icon buttons */
#bonus-dispute-screen .icon-btn {
  background: transparent !important;
  border: 1px solid #1a1a1a !important;
  color: #999999 !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  transition: all 0.15s !important;
}
#bonus-dispute-screen .icon-btn:hover {
  border-color: #3ecf8e !important;
  color: #3ecf8e !important;
}

/* ---------- Body container ---------- */
#bonus-dispute-screen > div:not(.app-header) {
  padding: 22px !important;
  max-width: 720px !important;
  margin: 0 auto !important;
}

/* ---------- Info tip callout (💡 blue box) ---------- */
#bonus-dispute-screen div[style*="background:var(--blue-bg)"] {
  background: linear-gradient(90deg, rgba(91, 158, 255, 0.08), transparent 70%) !important;
  border: none !important;
  border-top: 1px solid #1a1a1a !important;
  border-bottom: 1px solid #1a1a1a !important;
  border-radius: 0 !important;
  color: #e5e5e5 !important;
  padding: 14px 16px 14px 38px !important;
  margin: 0 0 22px 0 !important;
  font-family: -apple-system, 'Inter', sans-serif !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
  position: relative !important;
}
#bonus-dispute-screen div[style*="background:var(--blue-bg)"]::before {
  content: '' !important;
  position: absolute !important;
  left: 16px !important;
  top: 20px !important;
  width: 8px !important;
  height: 8px !important;
  background: #5b9eff !important;
  border-radius: 1px !important;
}

/* Green-bg callouts (success state) */
#bonus-dispute-screen div[style*="background:var(--green-bg)"] {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.08), transparent 70%) !important;
  border: none !important;
  border-top: 1px solid #1a1a1a !important;
  border-bottom: 1px solid #1a1a1a !important;
  border-radius: 0 !important;
  color: #e5e5e5 !important;
  padding: 14px 16px !important;
  font-family: -apple-system, 'Inter', sans-serif !important;
}

/* ---------- Section titles (admin-section-title reused) ---------- */
#bonus-dispute-screen .admin-section-title {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  letter-spacing: 1.5px !important;
  text-transform: uppercase !important;
  color: #999999 !important;
  margin-bottom: 14px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
#bonus-dispute-screen .admin-section-title::before {
  content: '' !important;
  display: inline-block !important;
  width: 6px !important;
  height: 6px !important;
  background: #3ecf8e !important;
  border-radius: 1px !important;
  flex-shrink: 0 !important;
}

/* ---------- "CLIENTS ADDED (0)" label ---------- */
#bonus-dispute-screen div[style*="text-transform:uppercase"] {
  color: #737373 !important;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 10px !important;
  letter-spacing: 1.5px !important;
}

/* ---------- White card containers (surface) ---------- */
#bonus-dispute-screen div[style*="background:var(--surface)"] {
  background: #0a0a0a !important;
  border: 1px solid #1a1a1a !important;
  border-radius: 4px !important;
  color: #fafafa !important;
}

/* ---------- Surface-alt containers ---------- */
#bonus-dispute-screen div[style*="background:var(--surface-alt)"] {
  background: #000000 !important;
  border: 1px solid #1a1a1a !important;
  border-radius: 4px !important;
  color: #e5e5e5 !important;
}

/* ---------- "+ Add a client" dashed button ---------- */
#bonus-dispute-screen button[style*="border-style:dashed"],
#bonus-dispute-screen div[style*="border-style:dashed"],
#bonus-dispute-screen button[style*="dashed"],
#bonus-dispute-screen [style*="border:2px dashed"],
#bonus-dispute-screen [style*="border: 2px dashed"] {
  background: transparent !important;
  border: 1px dashed #2a2a2a !important;
  color: #3ecf8e !important;
  border-radius: 4px !important;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 1.2px !important;
  text-transform: uppercase !important;
  padding: 16px !important;
  cursor: pointer !important;
  transition: all 0.15s !important;
  width: 100% !important;
}
#bonus-dispute-screen button[style*="dashed"]:hover,
#bonus-dispute-screen [style*="border:2px dashed"]:hover,
#bonus-dispute-screen [style*="border: 2px dashed"]:hover {
  border-color: #3ecf8e !important;
  background: rgba(62, 207, 142, 0.04) !important;
}

/* ---------- Primary action buttons ---------- */
#bonus-dispute-screen button[style*="background:var(--accent)"],
#bonus-dispute-screen .btn-primary {
  background: #3ecf8e !important;
  color: #000000 !important;
  border: none !important;
  border-radius: 4px !important;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 1.2px !important;
  text-transform: uppercase !important;
  padding: 12px 20px !important;
  cursor: pointer !important;
  transition: filter 0.15s !important;
}
#bonus-dispute-screen button[style*="background:var(--accent)"]:hover,
#bonus-dispute-screen .btn-primary:hover {
  filter: brightness(1.1) !important;
}

/* Secondary / outline buttons */
#bonus-dispute-screen button[style*="background:transparent"],
#bonus-dispute-screen .btn-secondary {
  background: transparent !important;
  border: 1px solid #1a1a1a !important;
  color: #999999 !important;
  border-radius: 4px !important;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 11px !important;
  letter-spacing: 1px !important;
  text-transform: uppercase !important;
  padding: 10px 16px !important;
  cursor: pointer !important;
  transition: all 0.15s !important;
}
#bonus-dispute-screen button[style*="background:transparent"]:hover,
#bonus-dispute-screen .btn-secondary:hover {
  border-color: #3ecf8e !important;
  color: #3ecf8e !important;
}

/* ---------- "View my past disputes →" link style button ---------- */
#bonus-dispute-screen a[style*="color:var(--accent)"],
#bonus-dispute-screen button[style*="color:var(--accent)"][style*="background:transparent"],
#bonus-dispute-screen span[style*="color:var(--accent)"] {
  color: #3ecf8e !important;
  font-family: -apple-system, 'Inter', sans-serif !important;
  font-size: 13px !important;
  text-decoration: none !important;
  cursor: pointer !important;
}
#bonus-dispute-screen a[style*="color:var(--accent)"]:hover {
  text-decoration: underline !important;
}

/* ---------- Inputs & textareas & selects ---------- */
#bonus-dispute-screen input[type="text"],
#bonus-dispute-screen input[type="number"],
#bonus-dispute-screen input[type="email"],
#bonus-dispute-screen input[type="date"],
#bonus-dispute-screen textarea,
#bonus-dispute-screen select {
  background: #000000 !important;
  border: 1px solid #1a1a1a !important;
  color: #fafafa !important;
  border-radius: 4px !important;
  font-family: -apple-system, 'Inter', sans-serif !important;
  font-size: 13px !important;
  padding: 10px 12px !important;
}
#bonus-dispute-screen input:focus,
#bonus-dispute-screen textarea:focus,
#bonus-dispute-screen select:focus {
  border-color: #3ecf8e !important;
  outline: none !important;
}
#bonus-dispute-screen input::placeholder,
#bonus-dispute-screen textarea::placeholder {
  color: #525252 !important;
}

/* Field labels */
#bonus-dispute-screen label {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 10px !important;
  font-weight: 500 !important;
  letter-spacing: 1.2px !important;
  text-transform: uppercase !important;
  color: #999999 !important;
  margin-bottom: 6px !important;
  display: block !important;
}

/* SEP form sections reused here */
#bonus-dispute-screen .sep-form-section {
  background: transparent !important;
  border: 1px solid #1a1a1a !important;
  border-radius: 4px !important;
  padding: 16px !important;
  margin-bottom: 12px !important;
}
#bonus-dispute-screen .sep-form-section-title {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 11px !important;
  letter-spacing: 1.2px !important;
  text-transform: uppercase !important;
  color: #fafafa !important;
  margin-bottom: 12px !important;
}
#bonus-dispute-screen .sep-field {
  margin-bottom: 12px !important;
}

/* ---------- Empty state ("No clients added yet...") ---------- */
#bonus-dispute-screen div[style*="text-align:center"] {
  color: #737373 !important;
  font-family: -apple-system, 'Inter', sans-serif !important;
  font-size: 13px !important;
}

/* Hide money-bag emoji and lightbulb emoji — they're text characters
   so we can't easily drop them. They'll stay visible but muted. */

/* ---------- Range buttons (admin filter) ---------- */
#bonus-dispute-screen .bonus-range-btn {
  background: transparent !important;
  border: 1px solid #1a1a1a !important;
  color: #999999 !important;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 10px !important;
  letter-spacing: 1px !important;
  text-transform: uppercase !important;
  border-radius: 4px !important;
  padding: 6px 12px !important;
  cursor: pointer !important;
  transition: all 0.15s !important;
}
#bonus-dispute-screen .bonus-range-btn:hover {
  border-color: #3ecf8e !important;
  color: #3ecf8e !important;
}
#bonus-dispute-screen .bonus-range-btn.active {
  background: #3ecf8e !important;
  color: #000000 !important;
  border-color: #3ecf8e !important;
  font-weight: 600 !important;
}

/* ---------- Back button (icon-btn at top left) ---------- */
#bonus-dispute-screen .header-left .icon-btn:first-child {
  background: transparent !important;
  border: 1px solid #1a1a1a !important;
  color: #fafafa !important;
}

/* ---------- Modals (dispute detail modal) ---------- */
body:has(#bonus-dispute-screen:not(.hidden)) .modal-overlay {
  background: rgba(0, 0, 0, 0.85) !important;
  backdrop-filter: blur(4px) !important;
}
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet {
  background: #0a0a0a !important;
  border: 1px solid #1a1a1a !important;
  border-top: 2px solid #3ecf8e !important;
  color: #fafafa !important;
  border-radius: 6px !important;
}
body:has(#bonus-dispute-screen:not(.hidden)) .modal-title {
  font-family: ui-serif, Georgia, serif !important;
  font-weight: 400 !important;
  color: #fafafa !important;
  text-transform: none !important;
}
body:has(#bonus-dispute-screen:not(.hidden)) .modal-subtitle {
  color: #737373 !important;
  font-family: -apple-system, 'Inter', sans-serif !important;
}

/* ---------- Status badges for dispute statuses ----------
   These use inline styles like background:var(--blue-bg);color:var(--blue) */
#bonus-dispute-screen span[style*="var(--blue)"][style*="var(--blue-bg)"] {
  background: rgba(91, 158, 255, 0.12) !important;
  color: #5b9eff !important;
  border: none !important;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 10px !important;
  letter-spacing: 1px !important;
  text-transform: uppercase !important;
  font-weight: 600 !important;
  border-radius: 2px !important;
  padding: 3px 8px !important;
}
#bonus-dispute-screen span[style*="var(--yellow)"][style*="var(--yellow-bg)"] {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #f59e0b !important;
}
#bonus-dispute-screen span[style*="var(--purple)"][style*="var(--purple-bg)"] {
  background: rgba(167, 139, 250, 0.12) !important;
  color: #a78bfa !important;
}
#bonus-dispute-screen span[style*="var(--green)"][style*="var(--green-bg)"] {
  background: rgba(34, 197, 94, 0.12) !important;
  color: #22c55e !important;
}
#bonus-dispute-screen span[style*="var(--red)"][style*="var(--red-bg)"] {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #ef4444 !important;
}

/* ---------- Money amounts ---------- */
#bonus-dispute-screen span[style*="font-weight:700"] {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
}

/* ============================================================
   HOTFIX 6.1 — Pick a policy picker modal
   ============================================================ */

/* The .modal-sheet when it contains the policy picker */
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet {
  color: #fafafa !important;
}

/* Policy list container (has border and surface background) */
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet div[style*="max-height:50vh"][style*="overflow-y:auto"] {
  background: #000000 !important;
  border: 1px solid #1a1a1a !important;
  border-radius: 4px !important;
}

/* Each policy row — the clickable div with onclick pickPolicy */
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet div[onclick*="_pickPolicy"] {
  color: #fafafa !important;
  border-bottom: 1px solid #1a1a1a !important;
  transition: background 0.15s !important;
}
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet div[onclick*="_pickPolicy"]:hover {
  background: rgba(62, 207, 142, 0.04) !important;
}

/* Client name inside each row */
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet div[onclick*="_pickPolicy"] div[style*="font-weight:500"] {
  color: #fafafa !important;
  font-family: ui-serif, Georgia, serif !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  letter-spacing: -0.1px !important;
}

/* MBI + carrier line */
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet div[onclick*="_pickPolicy"] div[style*="color:var(--text-muted)"] {
  color: #737373 !important;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 11px !important;
  letter-spacing: 0.5px !important;
}

/* Search box wrapper */
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet div[style*="background:var(--surface-alt)"][style*="padding:0 12px"] {
  background: #000000 !important;
  border: 1px solid #1a1a1a !important;
  border-radius: 4px !important;
}
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet div[style*="background:var(--surface-alt)"][style*="padding:0 12px"] > div:first-child {
  display: none !important;  /* drop the 🔍 emoji */
}
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet #bd-policy-search {
  background: transparent !important;
  color: #fafafa !important;
  font-family: -apple-system, 'Inter', sans-serif !important;
  font-size: 13px !important;
  border: none !important;
}
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet #bd-policy-search::placeholder {
  color: #525252 !important;
}

/* Filter pills (Active & recent / Show all) — already styled by patch 6
   but let's make sure they stay compact */
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet button.filter-pill,
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet div.filter-pill,
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet button[onclick*="showAll"],
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet [role="button"][onclick*="showAll"] {
  background: transparent !important;
  border: 1px solid #1a1a1a !important;
  color: #999999 !important;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 11px !important;
  letter-spacing: 1px !important;
  text-transform: uppercase !important;
  border-radius: 4px !important;
  padding: 10px 14px !important;
  cursor: pointer !important;
  flex: 1 !important;
}

/* "109 POLICIES" count label */
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet div[style*="text-transform:uppercase"][style*="letter-spacing:0.5px"] {
  color: #999999 !important;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 10px !important;
  letter-spacing: 1.5px !important;
  margin: 12px 2px 8px !important;
}

/* Status badge on right side of each row (e.g. "Future") */
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet div[onclick*="_pickPolicy"] span[style*="border-radius"],
body:has(#bonus-dispute-screen:not(.hidden)) .modal-sheet div[onclick*="_pickPolicy"] div[style*="border-radius"][style*="padding"] {
  background: rgba(91, 158, 255, 0.12) !important;
  color: #5b9eff !important;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 10px !important;
  letter-spacing: 1px !important;
  text-transform: uppercase !important;
  font-weight: 600 !important;
  border: none !important;
  border-radius: 2px !important;
  padding: 3px 8px !important;
}

/* ============================================================
   HOTFIX — nuke all remaining white on admin
   ============================================================ */

/* Any white-background element on admin becomes dark bordered card */
#admin-screen [style*="background:#fff"],
#admin-screen [style*="background: #fff"],
#admin-screen [style*="background:white"],
#admin-screen [style*="background: white"],
#admin-screen [style*="background:var(--surface)"],
#admin-screen [style*="background: var(--surface)"],
#admin-screen [style*="background:var(--bg)"],
#admin-screen [style*="background: var(--bg)"] {
  background: transparent !important;
  border: 1px solid #1a1a1a !important;
  border-radius: 4px !important;
  color: #fafafa !important;
  box-shadow: none !important;
}

/* Fix all text that was dark-on-white and now would be invisible */
#admin-screen [style*="color:#1d1d1f"],
#admin-screen [style*="color: #1d1d1f"],
#admin-screen [style*="color:#000"],
#admin-screen [style*="color: #000"],
#admin-screen [style*="color:var(--text)"],
#admin-screen [style*="color: var(--text)"] {
  color: #fafafa !important;
}

#admin-screen [style*="color:#6e6e73"],
#admin-screen [style*="color:var(--text-muted)"] {
  color: #999999 !important;
}

/* Admin tab bar (Overview / Commissions / Agents / Reports / Margin / Settings) */
#admin-screen [class*="admin-tab"],
#admin-screen .tab-bar,
#admin-screen [role="tablist"] {
  background: transparent !important;
  border: 1px solid #1a1a1a !important;
  border-radius: 4px !important;
  padding: 4px !important;
}
#admin-screen [class*="admin-tab"] button,
#admin-screen .tab-bar button,
#admin-screen [role="tab"] {
  background: transparent !important;
  color: #999999 !important;
  border: none !important;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  letter-spacing: 1.2px !important;
  text-transform: uppercase !important;
  padding: 10px 16px !important;
  border-radius: 4px !important;
  cursor: pointer !important;
}
#admin-screen [class*="admin-tab"] button.active,
#admin-screen .tab-bar button.active,
#admin-screen [role="tab"][aria-selected="true"],
#admin-screen [role="tab"].active {
  background: #0a0a0a !important;
  color: #fafafa !important;
}

/* Any "card" on admin with hardcoded white background */
#admin-screen .card,
#admin-screen .stat-card,
#admin-screen [class*="metric-card"],
#admin-screen [class*="bonus-stat"],
#admin-screen [class*="dialer-stat"] {
  background: transparent !important;
  border: 1px solid #1a1a1a !important;
  border-radius: 4px !important;
  box-shadow: none !important;
  color: #fafafa !important;
}

/* Filter pills (Last 7 / 30 / 90 / All time, Show/Hide resolved) */
#admin-screen [class*="range-btn"],
#admin-screen [class*="filter-btn"],
#admin-screen button[class*="pill"] {
  background: transparent !important;
  border: 1px solid #1a1a1a !important;
  color: #999999 !important;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 10px !important;
  letter-spacing: 1px !important;
  text-transform: uppercase !important;
  border-radius: 4px !important;
  padding: 7px 12px !important;
}
#admin-screen [class*="range-btn"].active,
#admin-screen [class*="filter-btn"].active,
#admin-screen button[class*="pill"].active {
  background: #3ecf8e !important;
  color: #000000 !important;
  border-color: #3ecf8e !important;
  font-weight: 700 !important;
}

/* Refresh / Export CSV / Fast review header buttons */
#admin-screen button[style*="background:var(--accent)"],
#admin-screen button[style*="background: var(--accent)"] {
  background: #3ecf8e !important;
  color: #000000 !important;
  border: none !important;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 1px !important;
  text-transform: uppercase !important;
  border-radius: 4px !important;
}

/* Agent list cards at the bottom */
#admin-screen [class*="agent-card"],
#admin-screen [class*="agent-row"],
#admin-screen [class*="agent-item"] {
  background: transparent !important;
  border: 1px solid #1a1a1a !important;
  border-radius: 4px !important;
  color: #fafafa !important;
  box-shadow: none !important;
}

/* Select dropdown ("Today") */
#admin-screen select,
#admin-screen select[class*="range"] {
  background: #0a0a0a !important;
  border: 1px solid #1a1a1a !important;
  color: #fafafa !important;
  border-radius: 4px !important;
  font-family: -apple-system, 'Inter', sans-serif !important;
  font-size: 12px !important;
  padding: 7px 12px !important;
}

/* Checkbox "Show resolved" */
#admin-screen input[type="checkbox"] {
  accent-color: #3ecf8e !important;
}

/* Avatar circles in agent list (GA, KL, WJ, AJ) */
#admin-screen [class*="avatar"],
#admin-screen [class*="initials"] {
  background: rgba(62, 207, 142, 0.12) !important;
  color: #3ecf8e !important;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  letter-spacing: 0.5px !important;
}
