/* ============================================================================
 * assets/css/agent_wallet.css — litcrm_agent_wallet_v1
 * Theme-native (drives entirely off platform CSS variables, so it follows the active
 * theme incl. FIFA). No hardcoded brand blues outside neutral fallbacks.
 * ========================================================================== */

.agent-wallet-page { display: flex; flex-direction: column; gap: 16px; }

/* summary cards */
.aw-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.aw-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.aw-card-label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted, #6b7280); }
.aw-card-value { font-size: 1.45rem; font-weight: 800; color: var(--text, #0f172a); line-height: 1.1; }
.aw-card-risk .aw-card-value { color: var(--danger, #ef4444); }

/* tabs */
.aw-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.aw-tab {
  border: 1px solid var(--border, rgba(17,24,39,.10));
  background: var(--panel, var(--white, #fff));
  color: var(--text, #1f2937);
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.aw-tab:hover { border-color: var(--primary, #2bb59b); }
.aw-tab.is-active { background: var(--primary, #2bb59b); border-color: var(--primary, #2bb59b); color: #fff; }

/* panels */
.aw-panel { padding: 16px 18px; }
.aw-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.aw-search { width: auto; min-width: 220px; }
.aw-overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 10px; }
@media (max-width: 720px) { .aw-overview-grid { grid-template-columns: 1fr; } }
.aw-mini-list { display: flex; flex-direction: column; gap: 6px; }
.aw-mini { padding: 8px 10px; border: 1px solid var(--border, rgba(17,24,39,.10)); border-radius: 10px; background: var(--panel, #fff); }

/* tables */
.aw-table-wrap { overflow-x: auto; }
.aw-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.aw-table th, .aw-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border, rgba(17,24,39,.08)); vertical-align: top; }
.aw-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6b7280); font-weight: 800; }
.aw-table tbody tr:hover { background: var(--primary-soft, rgba(43,181,155,.06)); }
.aw-pol { margin-bottom: 4px; }
.aw-link { color: var(--primary-dark, #1f9d86); font-weight: 700; }
.aw-chip { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; background: var(--primary-soft, rgba(43,181,155,.12)); color: var(--primary-dark, #1f9d86); }
.aw-stage-select { width: auto; min-width: 150px; padding: 5px 8px; }

/* risk flags */
.aw-flag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; border: 1px solid var(--border, rgba(17,24,39,.12)); }
.aw-flag-chargeback, .aw-flag-canceled, .aw-flag-declined { background: rgba(239,68,68,.12); color: #b91c1c; border-color: rgba(239,68,68,.30); }
.aw-flag-lapsed { background: rgba(245,158,11,.14); color: #92400e; border-color: rgba(245,158,11,.30); }
.aw-flag-missing_contact { background: rgba(148,163,184,.16); color: #475569; }

/* modal */
.aw-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; }
.aw-modal[hidden] { display: none; }
.aw-modal-overlay { position: absolute; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(3px); }
.aw-modal-dialog { position: relative; z-index: 1; width: min(640px, calc(100vw - 36px)); max-height: calc(100vh - 60px); overflow: auto; padding: 20px; }
.aw-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.aw-form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted, #475569); }
.aw-form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
@media (max-width: 560px) { .aw-form-grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) { .aw-tab { transition: none; } }

/* ── export toolbar (litcrm_agent_wallet_export_v1) ── */
.agent-wallet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.aw-export-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aw-export-label { font-size: 12px; font-weight: 700; color: var(--muted, #6b7280); text-transform: uppercase; letter-spacing: .04em; }
.aw-export-toolbar .btn-sm { text-decoration: none; }
@media (max-width: 720px){ .aw-export-toolbar { width: 100%; } }

/* ── V2: agent selector, profile drawer, notes (litcrm_agent_wallet_v2) ── */
.aw-head-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.aw-agent-picker { display: inline-flex; align-items: center; gap: 8px; }
.aw-agent-picker .input { width: auto; min-width: 200px; padding: 7px 10px; border-radius: 999px; }
/* [2026-10-31] display:inline-flex above overrode [hidden], so an empty picker showed as a blank
   select with a sliver of a list. Hidden means hidden. The header (unified_header.css .page-head)
   clips overflow; let the wallet header show its controls whole. */
.aw-agent-picker[hidden] { display: none !important; }
.agent-wallet-head { overflow: visible; }
.aw-owner-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; background: var(--primary-soft, rgba(43,181,155,.12)); color: var(--primary-dark, #1f9d86); }
.aw-cust-row.aw-rowlink { cursor: pointer; }
.aw-linkbtn { background: none; border: 0; padding: 0; color: var(--primary-dark, #1f9d86); font: inherit; font-weight: 800; cursor: pointer; text-align: left; }

/* drawer */
.aw-drawer { position: fixed; inset: 0; z-index: 10001; display: flex; justify-content: flex-end; }
.aw-drawer[hidden] { display: none; }
.aw-drawer-overlay { position: absolute; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(2px); }
.aw-drawer-panel { position: relative; z-index: 1; width: min(760px, 100vw); max-width: 100vw; height: 100%; overflow: auto; border-radius: 0; padding: 0; display: flex; flex-direction: column; }
.aw-drawer-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px; background: var(--lit-banner-grad, var(--panel, #fff)); border-bottom: 1px solid var(--border, rgba(17,24,39,.1)); }
.aw-drawer-head h2 { margin: 0; }
.aw-drawer-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 18px; }
.aw-profile-section h3 { margin: 0 0 10px; font-size: 14px; }
.aw-form-wide { grid-column: 1 / -1; }
.aw-policies td, .aw-policies th { padding: 8px 10px; }
.aw-chip-risk { background: rgba(239,68,68,.14) !important; color: #b91c1c !important; }

/* notes */
.aw-note-form { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.aw-note-type { width: auto; min-width: 140px; }
.aw-note-input { flex: 1; min-width: 180px; }
.aw-notes-list { display: flex; flex-direction: column; gap: 8px; }
.aw-note { border: 1px solid var(--border, rgba(17,24,39,.1)); border-radius: 10px; padding: 10px 12px; background: var(--panel, #fff); }
.aw-note-meta { margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.aw-note-badge { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; background: var(--primary-soft, rgba(43,181,155,.12)); color: var(--primary-dark, #1f9d86); }
.aw-note-del { margin-left: auto; background: none; border: 0; color: var(--muted, #6b7280); cursor: pointer; font-size: 12px; }
@media (max-width: 640px){ .aw-drawer-panel { width: 100vw; } }

/* ── V2.1: obvious Open Profile affordance + agent picker groups ── */
.aw-cust-row.aw-rowlink { cursor: pointer; }
.aw-cust-row.aw-rowlink:hover { background: var(--primary-soft, rgba(43,181,155,.07)); }
.wallet-open-profile.aw-linkbtn { font-weight: 800; color: var(--primary-dark, #1f9d86); text-decoration: underline; text-underline-offset: 2px; }
.wallet-open-profile.aw-linkbtn:hover { color: var(--primary, #2bb59b); }
td .wallet-open-profile.btn { white-space: nowrap; }
.aw-agent-picker select optgroup { font-weight: 800; }
