
/* Smart Collections V1: all visual overrides are isolated to collections and its dialog. */
.smart-collections-v1{
  --cv1-border:color-mix(in srgb,var(--line) 86%,#2979ff 14%);
  --cv1-panel:color-mix(in srgb,var(--card) 93%,#0b1830 7%);
  --cv1-soft:color-mix(in srgb,var(--card) 75%,var(--bg) 25%);
  color:var(--text);min-width:0;display:grid;gap:13px;
}
[data-theme="dark"] .smart-collections-v1{
  --cv1-panel:#101f38;--cv1-soft:#0b1830;--cv1-border:#253b5e;
}
.smart-collections-v1 *,.smart-collections-v1 *::before,.smart-collections-v1 *::after{box-sizing:border-box}
.cv1-head{display:flex;align-items:center;justify-content:space-between;min-width:0;gap:12px;padding:6px 3px 9px}
.cv1-head h2{font-size:23px;line-height:1.25;font-weight:900;margin:3px 0}
.cv1-head p{font-size:12px;color:var(--muted);margin:0}
.cv1-kicker{font-size:10px;color:#2979ff;font-weight:900;letter-spacing:1.4px}
.cv1-head-glyph{height:48px;width:48px;display:grid;place-items:center;border-radius:15px;background:color-mix(in srgb,#2979ff 17%,var(--card));color:#2979ff;flex:none}
.cv1-head-glyph svg{width:24px;height:24px}
.cv1-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;min-width:0}
.cv1-kpi{min-width:0;min-height:103px;padding:13px;display:flex;align-items:center;gap:10px;border:1px solid var(--cv1-border);border-radius:14px;background:var(--cv1-panel);box-shadow:0 7px 24px rgba(0,0,0,.07)}
.cv1-kpi>div:last-child{display:grid;align-content:center;gap:4px;min-width:0}
.cv1-kpi small{color:var(--muted);font-size:11px;font-weight:750}
.cv1-kpi strong{font-size:clamp(16px,1.55vw,24px);font-weight:900;font-variant-numeric:tabular-nums;white-space:nowrap}
.cv1-kpi span{font-size:10px;color:var(--muted)}
.cv1-kpi-icon{width:42px;height:42px;border-radius:12px;flex:none;display:grid;place-items:center;background:rgba(35,183,156,.14);color:#23b79c}
.cv1-kpi-icon svg{width:22px;height:22px}
.cv1-kpi.blue .cv1-kpi-icon{color:#2979ff;background:rgba(41,121,255,.17)}
.cv1-kpi.cyan .cv1-kpi-icon{color:#26b9df;background:rgba(38,185,223,.15)}
.cv1-kpi.amber .cv1-kpi-icon{color:#c9a66b;background:rgba(201,166,107,.18)}
.cv1-analytics{min-width:0;display:grid;grid-template-columns:minmax(0,1.55fr) minmax(270px,1fr);gap:11px}
.cv1-panel{background:var(--cv1-panel);border:1px solid var(--cv1-border);border-radius:15px;min-width:0;overflow:hidden;box-shadow:0 9px 24px rgba(0,0,0,.06)}
.cv1-panel-head{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:14px 15px;border-bottom:1px solid var(--cv1-border)}
.cv1-panel-head h3{font-size:14px;font-weight:850;margin:0}
.cv1-panel-head span,.cv1-panel-head small{font-size:10px;color:var(--muted)}
.cv1-panel-head .btn{min-height:32px}
.cv1-panel-head .ui-icon{width:15px;height:15px}
.cv1-chart{padding:6px 13px 2px;min-height:223px;display:grid;align-items:center}
.cv1-chart-frame{width:100%;min-width:0}
.cv1-chart-frame svg{height:188px;width:100%;overflow:visible}
.cv1-chart-grid{stroke:var(--cv1-border);stroke-width:1;stroke-dasharray:3 5}
.cv1-chart-label{fill:var(--muted);font-size:11px}
.cv1-chart-foot{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;font-size:10px;color:var(--muted);padding:2px 12px 7px}
.cv1-empty-chart{display:grid;place-items:center;text-align:center;min-height:200px;color:var(--muted);font-size:12px}
.cv1-followup-list{padding:4px 11px}
.cv1-followup{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 1px;border-bottom:1px solid var(--cv1-border)}
.cv1-followup:last-child{border:0}
.cv1-followup-info{min-width:0;display:grid;gap:3px}
.cv1-followup-info b{font-size:12px;font-weight:800}
.cv1-followup-info small{font-size:10px;color:var(--muted)}
.cv1-followup-info strong{font-size:12px;color:#c9a66b;font-weight:900}
.cv1-followup .btn{min-width:65px;min-height:32px;flex:none}
.cv1-ledger .cv1-panel-head>div{display:grid;gap:4px}
.cv1-filters{display:grid;grid-template-columns:1.7fr repeat(2,minmax(117px,1fr)) repeat(3,minmax(122px,1fr)) auto;gap:8px;align-items:end;padding:12px 13px;border-bottom:1px solid var(--cv1-border)}
.cv1-filters label{display:grid;gap:5px;min-width:0;color:var(--muted);font-size:10px;font-weight:800}
.cv1-filters input,.cv1-filters select{height:36px;width:100%;min-width:0;background:var(--cv1-soft);border:1px solid var(--cv1-border);color:var(--text);border-radius:9px;font-size:11px;padding:6px 9px;outline:none}
.cv1-filters input:focus,.cv1-filters select:focus{border-color:#2979ff;box-shadow:0 0 0 2px rgba(41,121,255,.18)}
.cv1-filters .cv1-reset{height:36px;white-space:nowrap}
.cv1-table-wrap{max-width:100%;min-width:0;overflow-x:auto}
.cv1-table{width:100%;min-width:790px;border-collapse:collapse}
.cv1-table thead{background:var(--cv1-soft)}
.cv1-table th{color:var(--muted);font-size:10px;font-weight:850;text-align:start;padding:11px 10px;white-space:nowrap}
.cv1-table td{font-size:11px;padding:10px;border-top:1px solid var(--cv1-border);text-align:start;vertical-align:middle}
.cv1-table tbody tr{cursor:pointer}
.cv1-table tbody tr:hover,.cv1-table tbody tr:focus-visible{background:rgba(41,121,255,.07);outline:0}
.cv1-table td b{font-size:11px}
.cv1-table td small{display:block;font-size:9px;color:var(--muted);margin-top:3px}
.cv1-table .cv1-receipt-id{font-variant-numeric:tabular-nums;color:#2979ff;white-space:nowrap}
.cv1-table td.cv1-amount{font-size:13px;font-weight:900;white-space:nowrap}
.cv1-status{display:inline-block;color:#23b79c;background:rgba(35,183,156,.12);border-radius:8px;padding:5px 7px;white-space:nowrap;font-size:10px;font-weight:800}
.cv1-row-actions{white-space:nowrap}
.cv1-row-actions .btn{margin-inline-end:4px;min-height:31px;font-size:10px}
.cv1-loading{min-height:130px;display:grid;place-items:center;font-size:12px;color:var(--muted)}
.cv1-skeleton{height:102px;border-radius:12px;border:1px solid var(--cv1-border);background:var(--cv1-panel)}
.cv1-empty{min-height:130px;text-align:center;padding:24px 13px;color:var(--muted);font-size:12px;display:grid;justify-items:center;align-content:center;gap:8px}
.cv1-empty b{color:var(--text)}
.cv1-empty p{margin:0}
.cv1-error .btn{margin-top:3px}
.cv1-pager{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 13px;border-top:1px solid var(--cv1-border);font-size:11px;color:var(--muted)}
.cv1-pager-actions{display:flex;align-items:center;gap:7px}
.cv1-pager-actions label{display:flex;align-items:center;gap:5px}
.cv1-pager select{border:1px solid var(--cv1-border);border-radius:8px;color:var(--text);background:var(--cv1-soft);height:31px}
.cv1-pager button:disabled{opacity:.4;cursor:default}
.cv1-pager b{color:var(--text);min-width:22px;text-align:center}
.cv1-explanation{font-size:10px;color:var(--muted);padding:0 13px 10px;margin:0}
/* The shared financial form continues to own validation and posting. */
#entityDialog:has(.smart-collection-form){width:min(690px,calc(100vw - 18px));max-width:100%}
.smart-collection-form{display:grid;gap:14px;min-width:0}
.smart-collection-form .form-grid{min-width:0;gap:11px}
.smart-collection-form .cv1-form-intro{font-size:12px;color:var(--muted);margin:0;padding:4px 0}
.smart-collection-form .cv1-methods{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px}
.smart-collection-form .cv1-methods button{min-width:0;border:1px solid var(--line);border-radius:11px;background:var(--card);color:var(--text);font-size:11px;font-weight:800;padding:11px 5px;display:flex;justify-content:center;gap:5px;align-items:center;cursor:pointer}
.smart-collection-form .cv1-methods button.is-active{border-color:#2979ff;box-shadow:inset 0 0 0 1px #2979ff;background:color-mix(in srgb,#2979ff 16%,var(--card));color:var(--text)}
.smart-collection-form .cv1-methods button:focus-visible{outline:2px solid #2979ff}
.smart-collection-form .cv1-methods .ui-icon{width:16px;height:16px}
.smart-collection-form .cv1-method-native{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.smart-collection-form .cv1-allocations-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin:0 0 9px}
.smart-collection-form .cv1-allocations-head b{font-size:13px}
.smart-collection-form .cv1-tax-note{font-size:10px;color:var(--muted);line-height:1.6;border-inline-start:2px solid #c9a66b;padding-inline-start:10px}
.smart-collection-form .return-lines{max-height:260px;overflow-y:auto}
.smart-collection-form .return-line{background:color-mix(in srgb,var(--card) 90%,var(--bg));border:1px solid var(--line);border-radius:9px;margin-bottom:6px;padding:9px}
.smart-collection-form [data-payment-summary]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;border:1px solid var(--line);background:var(--card);padding:12px;border-radius:11px}
.smart-collection-form [data-payment-summary]>div{display:flex;justify-content:space-between;gap:9px;font-size:11px;align-items:center}
.smart-collection-form [data-payment-summary] strong{font-weight:850;white-space:nowrap}
.smart-collection-form [data-payment-summary] .cv1-summary-warning{grid-column:1/-1;color:var(--red);font-size:11px}
.smart-collection-form .cv1-summary-foot{font-size:10px;color:var(--muted)}
@media(max-width:1230px){.cv1-filters{grid-template-columns:repeat(4,minmax(0,1fr))}.cv1-search{grid-column:span 2}.cv1-reset{grid-column:span 1}}
@media(max-width:920px){.cv1-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.cv1-analytics{grid-template-columns:1fr}}
@media(max-width:680px){
  .smart-collections-v1{gap:10px}
  .cv1-head{padding:1px 0 4px}
  .cv1-head h2{font-size:20px}
  .cv1-head p{font-size:11px}
  .cv1-head-glyph{height:41px;width:41px}
  .cv1-kpis{gap:7px}
  .cv1-kpi{padding:9px;min-height:85px;gap:7px}
  .cv1-kpi-icon{width:34px;height:34px;border-radius:9px}
  .cv1-kpi-icon svg{width:18px;height:18px}
  .cv1-kpi strong{font-size:16px}
  .cv1-kpi small{font-size:10px}
  .cv1-panel-head{padding:10px}
  .cv1-chart{min-height:170px;padding:4px 8px}
  .cv1-chart-frame svg{height:155px}
  .cv1-filters{padding:10px;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
  .cv1-filters label{font-size:10px}
  .cv1-search{grid-column:1/-1}
  .cv1-reset{grid-column:1/-1}
  .cv1-table-wrap{overflow:visible;padding:8px}
  .cv1-table{min-width:0;display:block}
  .cv1-table thead{display:none}
  .cv1-table tbody{display:grid;gap:8px}
  .cv1-table tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;padding:11px;border:1px solid var(--cv1-border);border-radius:12px;background:var(--cv1-soft)}
  .cv1-table td{border:0;padding:0;min-width:0;overflow-wrap:anywhere;font-size:11px}
  .cv1-table td::before{content:attr(data-label);display:block;color:var(--muted);font-weight:700;font-size:9px;margin-bottom:3px}
  .cv1-table td:first-child,.cv1-table td:nth-child(2){grid-column:auto}
  .cv1-table td:nth-child(4),.cv1-table td:nth-child(6){font-size:10px}
  .cv1-table td.cv1-row-actions{grid-column:1/-1;display:flex;gap:6px;margin-top:4px}
  .cv1-table td.cv1-row-actions .btn{flex:1;min-height:34px;margin:0}
  .cv1-pager{flex-wrap:wrap;padding:9px;font-size:10px}
  .cv1-pager-actions{width:100%;justify-content:space-between}
  .smart-collection-form .cv1-methods{gap:4px}
  .smart-collection-form .cv1-methods button{padding:9px 2px;font-size:10px}
  .smart-collection-form [data-payment-summary]{gap:8px;padding:10px}
}
@media(max-width:355px){
  .cv1-kpi{display:block}
  .cv1-kpi-icon{margin-bottom:6px}
  .cv1-kpi strong{font-size:14px}
  .smart-collection-form .cv1-methods button{font-size:9px}
}

/* Receipt dialog uses the same branded collection surface in both themes. */
.cv1-receipt-detail .invoice-detail-mobile-header{background:color-mix(in srgb,var(--card) 85%,#0b1830 15%);border:1px solid var(--line);border-radius:12px;padding:12px 14px}
.cv1-receipt-detail .invoice-detail-mobile-header h3{font-size:16px;font-weight:900;margin:4px 0 0}
.cv1-receipt-kicker{font-size:9px;color:#2979ff;font-weight:850;letter-spacing:1px}
.cv1-receipt-detail .invoice-detail-facts{gap:8px}
.cv1-receipt-detail .invoice-detail-fact{border-radius:10px}
.cv1-receipt-detail .invoice-detail-financial{border:1px solid var(--line);border-radius:11px;background:var(--card);padding:10px}
.cv1-receipt-detail .invoice-detail-sticky-actions{display:flex;flex-wrap:wrap;gap:7px;justify-content:flex-start}
.cv1-receipt-detail .invoice-detail-sticky-actions .btn{min-height:36px}
/* Explicit in-dialog alternatives remain visible when native sharing is unavailable. */
.cv1-receipt-detail .cv1-share-options{display:flex;flex:1 1 100%;flex-wrap:wrap;gap:7px;align-items:center;min-width:0}
.cv1-receipt-detail .cv1-share-options[hidden],.cv1-receipt-detail .cv1-share-manual[hidden]{display:none!important}
.cv1-receipt-detail .cv1-share-feedback{flex:1 1 100%;font-size:11px;color:var(--muted)}
.cv1-receipt-detail .cv1-share-manual{flex:1 1 100%;min-width:0}
.cv1-receipt-detail .cv1-share-manual label{font-size:11px;color:var(--muted);display:block}
.cv1-receipt-detail .cv1-share-manual textarea{width:100%;min-width:0;max-width:100%;box-sizing:border-box;display:block;margin-top:5px;border:1px solid var(--line);border-radius:8px;background:var(--card);color:var(--text);padding:8px;resize:vertical}
