/* HC App: the Money tab (migration 066), drawn by public/tab-money.js.
   Every class starts with hcm- and uses the page's own colors (index.html
   :root), so the tab follows the Athena sage theme. Phone first; the laptop
   layout widens the page, puts totals and buckets in grids and the sheet in
   the middle of the screen. */
.money-wrap{max-width:960px;margin:0 auto;padding:12px 16px 48px}
.hcm{display:flex;flex-direction:column;gap:14px}
.hcm-empty{text-align:center;color:var(--text-muted);font-size:13.5px;line-height:1.5;padding:22px 16px;background:var(--surface);border:1.5px dashed var(--border-mid);border-radius:var(--radius-lg)}
.hcm-empty strong{display:block;color:var(--text);font-size:15px;margin-bottom:4px}
.hcm-empty .hcm-btn{margin-top:10px}
.hcm-empty-good{border-style:solid;background:var(--green-wash);color:var(--green);font-weight:700}

/* Header: title, QuickBooks as of, Refresh */
.hcm-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-top:6px}
.hcm-title{font-size:22px;font-weight:800;letter-spacing:-.4px;color:var(--text)}
.hcm-asof{font-size:12.5px;color:var(--text-muted);margin-top:3px;line-height:1.4}
.hcm-head-actions{flex-shrink:0}
.hcm-pending,.hcm-notice{background:var(--blue-pale);color:#1d4ed8;border-radius:12px;padding:10px 12px;font-size:13px;font-weight:600;line-height:1.45}
.hcm-notice{background:var(--amber-pale);color:var(--amber-dark)}
.hcm-banner{background:var(--red-pale);color:var(--red-dark);border:1px solid rgba(229,72,77,.35);border-left:4px solid var(--red);border-radius:12px;padding:12px 14px;font-size:13.5px;font-weight:650;line-height:1.5}

/* Buttons */
.hcm-btn{min-height:44px;padding:0 14px;border-radius:10px;border:1px solid var(--border-mid);background:var(--surface);color:var(--text);font:inherit;font-size:13px;font-weight:700;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;text-decoration:none;white-space:nowrap;box-shadow:var(--shadow-sm)}
.hcm-btn:hover{background:var(--surface2)}
.hcm-btn:disabled{opacity:.5;cursor:not-allowed}
.hcm-btn-primary{background:var(--brand-fill);border-color:var(--brand-fill-press);color:var(--on-brand)}
.hcm-btn-primary:hover{background:var(--brand-fill-hover)}
.hcm-btn-quiet{background:none;box-shadow:none;color:var(--text-muted)}
.hcm-btn-quiet:hover{color:var(--text);background:var(--surface2)}
.hcm-btn-small{min-height:36px;padding:0 11px;font-size:12px}
.hcm-btn.hcm-on,.hcm-tab.hcm-on{background:var(--soft-fill);border-color:var(--soft-edge);color:var(--on-soft)}

/* Sections */
.hcm-section{display:flex;flex-direction:column;gap:8px}
.hcm-h{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.8px;color:var(--text-hint);margin:6px 2px 0}
.hcm-h4{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.6px;color:var(--text-hint);margin:14px 0 4px}
.hcm-count{background:var(--brand-fill);color:var(--on-brand);border-radius:20px;font-size:11px;padding:2px 8px;letter-spacing:0}
.hcm-sub{font-size:12.5px;color:var(--text-muted);line-height:1.45;margin:0 2px}
.hcm-muted{font-size:13px;color:var(--text-muted);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:12px 14px}
.hcm-foot{font-size:12px;color:var(--text-hint);line-height:1.5;margin:10px 2px 0}

/* Do next cards */
.hcm-item{background:var(--surface);border:1px solid var(--border);border-left:4px solid var(--border-mid);border-radius:var(--radius-lg);padding:13px 14px;box-shadow:var(--shadow-sm);display:flex;flex-direction:column;gap:8px}
.hcm-kind-stale,.hcm-kind-not_reconciled{border-left-color:var(--red)}
.hcm-kind-promise_due{border-left-color:var(--amber)}
.hcm-kind-no_contact{border-left-color:var(--brand-fill)}
.hcm-kind-paid_not_recorded{border-left-color:var(--blue)}
.hcm-kind-void{border-left-color:var(--text-hint)}
.hcm-kind-drift{border-left-color:var(--gold-ui)}
.hcm-item-top{display:flex;align-items:flex-start;gap:10px}
.hcm-rank{flex-shrink:0;width:24px;height:24px;border-radius:50%;background:var(--surface2);border:1px solid var(--border-mid);font-size:12px;font-weight:800;color:var(--text-muted);display:flex;align-items:center;justify-content:center}
.hcm-item-title{flex:1;min-width:0;font-size:15px;font-weight:800;color:var(--text);line-height:1.35;overflow-wrap:anywhere}
.hcm-amt{flex-shrink:0;font-size:15px;font-weight:800;color:var(--text);font-variant-numeric:tabular-nums}
.hcm-item-why{font-size:13.5px;color:var(--text);line-height:1.5;overflow-wrap:anywhere;margin:0}
.hcm-how{margin:0 0 0 20px;padding:0;font-size:13px;color:var(--text-muted);line-height:1.55}
.hcm-how li{padding-left:2px}
.hcm-actions{display:flex;flex-wrap:wrap;gap:8px}
.hcm-marks{display:flex;flex-wrap:wrap;align-items:center;gap:4px;border-top:1px solid var(--border);padding-top:8px}
.hcm-marks-label{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.6px;color:var(--text-hint);margin-right:4px}
.hcm-warn{background:var(--amber-pale);color:var(--amber-dark);border-radius:10px;padding:8px 10px;font-size:12.5px;font-weight:650;line-height:1.4}
.hcm-good{background:var(--green-wash);color:var(--green);border-radius:10px;padding:8px 10px;font-size:13px;font-weight:700}

/* Totals */
.hcm-tiles{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.hcm-tile{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:12px 14px;box-shadow:var(--shadow-sm);min-width:0}
.hcm-tile-label{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.5px;color:var(--text-muted)}
.hcm-tile-value{font-size:21px;font-weight:800;letter-spacing:-.5px;color:var(--text);margin-top:4px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.hcm-tile-sub{font-size:12px;color:var(--text-muted);margin-top:3px;line-height:1.4}
.hcm-match{align-self:flex-start;background:var(--green-pale);color:var(--green);border-radius:20px;padding:5px 12px;font-size:12px;font-weight:800}

/* Buckets */
.hcm-buckets{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.hcm-bucket{min-height:44px;display:flex;flex-direction:column;align-items:flex-start;gap:2px;text-align:left;background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:9px 12px;font:inherit;cursor:pointer;box-shadow:var(--shadow-sm)}
.hcm-bucket:hover{border-color:var(--border-mid)}
.hcm-bucket.hcm-on{background:var(--soft-fill);border-color:var(--soft-edge)}
.hcm-bucket-name{font-size:12.5px;font-weight:800;color:var(--text)}
.hcm-bucket-amt{font-size:14px;font-weight:800;color:var(--text);font-variant-numeric:tabular-nums}
.hcm-bucket-n{font-size:11.5px;color:var(--text-muted)}
.hcm-b-truly_owed{border-left:4px solid var(--brand-fill)}
.hcm-b-paid_not_recorded{border-left:4px solid var(--blue)}
.hcm-b-disputed{border-left:4px solid var(--red)}
.hcm-b-unknown{border-left:4px solid var(--amber)}
.hcm-b-unsorted{border-left:4px solid var(--gold-ui)}

/* Aging */
.hcm-seg{display:flex;flex-wrap:wrap;gap:6px}
.hcm-aging{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:8px 14px}
.hcm-age{display:grid;grid-template-columns:110px minmax(0,1fr) auto;align-items:center;gap:10px;min-height:34px;font-size:13px}
.hcm-age-label{color:var(--text-muted);font-weight:600}
.hcm-age-bar{height:8px;background:var(--surface2);border-radius:6px;overflow:hidden}
.hcm-age-bar span{display:block;height:100%;background:var(--green-mid2);border-radius:6px}
.hcm-age-amt{font-weight:800;font-variant-numeric:tabular-nums;color:var(--text)}

/* Invoice lists */
.hcm-tabs{display:flex;gap:6px;overflow-x:auto;-webkit-overflow-scrolling:touch;padding-bottom:2px}
.hcm-tab{flex-shrink:0;border-radius:22px;font-size:12.5px}
.hcm-input{width:100%;min-height:44px;font:inherit;font-size:14px;padding:9px 12px;border:1px solid var(--border-mid);border-radius:var(--radius);background:var(--surface);color:var(--text);outline:none}
.hcm-input:focus{border-color:var(--green-light);box-shadow:0 0 0 3px var(--green-pale)}
.hcm-area{min-height:84px;resize:vertical;line-height:1.45}
.hcm-list-body{display:flex;flex-direction:column;gap:12px}
.hcm-group{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--shadow-sm);overflow:hidden}
.hcm-cust{width:100%;min-height:48px;display:flex;align-items:center;gap:10px;background:var(--surface2);border:0;border-bottom:1px solid var(--border);padding:10px 14px;font:inherit;cursor:pointer;text-align:left}
.hcm-cust:hover{background:var(--green-wash)}
.hcm-cust-name{flex:1;min-width:0;font-size:14px;font-weight:800;color:var(--text);overflow-wrap:anywhere}
.hcm-cust-amt{font-size:14px;font-weight:800;color:var(--text);font-variant-numeric:tabular-nums}
.hcm-cust-n{font-size:12px;color:var(--text-muted);white-space:nowrap}
.hcm-row{width:100%;display:flex;flex-direction:column;gap:6px;text-align:left;background:none;border:0;border-bottom:1px solid var(--border);padding:11px 14px;font:inherit;cursor:pointer;min-height:44px}
.hcm-row:last-child{border-bottom:0}
.hcm-row:hover{background:var(--green-wash)}
.hcm-row-top{display:flex;justify-content:space-between;align-items:baseline;gap:10px}
.hcm-row-ref{font-size:14px;font-weight:800;color:var(--text)}
.hcm-row-amt{font-size:13px;font-weight:700;color:var(--text);text-align:right;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.hcm-chips{display:flex;flex-wrap:wrap;gap:5px}
.hcm-chip{font-size:10.5px;font-weight:800;padding:3px 8px;border-radius:20px;background:#eef1f4;color:var(--text-muted);white-space:nowrap;border-left:0}
.hcm-chip-warn{background:var(--amber-pale);color:var(--amber-dark)}
.hcm-chip-info{background:var(--blue-pale);color:#1d4ed8}
.hcm-chip-good{background:var(--green-pale);color:var(--green)}
.hcm-row-bits,.hcm-row-more{display:flex;flex-wrap:wrap;gap:4px 12px;font-size:12px;color:var(--text-muted);line-height:1.4}
.hcm-row-more{color:var(--text)}
.hcm-drift{background:var(--surface);border:1px solid var(--border);border-left:4px solid var(--gold-ui);border-radius:var(--radius-lg);padding:12px 14px;display:flex;flex-direction:column;gap:8px}

/* Requests to Jarvis and History */
.hcm-req,.hcm-hrow{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:10px 12px}
.hcm-req-main,.hcm-hrow-main{min-width:0;flex:1}
.hcm-req-title,.hcm-hrow-what{font-size:13.5px;font-weight:750;color:var(--text);overflow-wrap:anywhere}
.hcm-req-line,.hcm-hrow-note{font-size:12.5px;color:var(--text-muted);line-height:1.45;margin-top:2px;overflow-wrap:anywhere}
.hcm-hrow-when{font-size:11.5px;color:var(--text-hint);margin-top:3px}
.hcm-fold{min-height:44px;width:100%;text-align:left;background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:0 14px;font:inherit;font-size:13px;font-weight:800;color:var(--text);cursor:pointer}
.hcm-hist{display:flex;flex-direction:column;gap:6px}

/* Sheets */
.hcm-overlay{position:fixed;inset:0;z-index:1200;background:rgba(13,26,20,.5);display:flex;align-items:flex-end;justify-content:center}
.hcm-sheet{background:var(--surface);width:100%;max-height:92vh;overflow-y:auto;-webkit-overflow-scrolling:touch;border-radius:var(--radius-2xl) var(--radius-2xl) 0 0;padding:18px 16px calc(18px + env(safe-area-inset-bottom));box-shadow:var(--shadow-lg)}
.hcm-sheet-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:8px}
.hcm-sheet-title{font-size:18px;font-weight:800;letter-spacing:-.3px;color:var(--text);line-height:1.3;overflow-wrap:anywhere}
.hcm-sheet-body{display:flex;flex-direction:column;gap:12px}
.hcm-sheet-error{margin-top:12px;background:var(--red-pale);color:var(--red-dark);border-radius:10px;padding:10px 12px;font-size:13px;font-weight:650;line-height:1.45}
.hcm-sheet-actions{display:flex;gap:8px;margin-top:14px;position:sticky;bottom:0;background:var(--surface);padding-top:8px}
.hcm-sheet-actions .hcm-btn{flex:1}
.hcm-field{display:flex;flex-direction:column;gap:6px}
/* The payment sheet's "Which money is this?" box (its note sits over the choice). */
.hcm-pay-part{display:flex;flex-direction:column;gap:6px}
.hcm-label{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.5px;color:var(--text-muted)}
.hcm-hint{font-size:12px;color:var(--text-muted);line-height:1.45}
.hcm-pick{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.hcm-pick .hcm-btn{white-space:normal;text-align:left;justify-content:flex-start;line-height:1.25}
.hcm-split{display:grid;grid-template-columns:minmax(0,1fr) 110px auto;gap:6px;align-items:center}
.hcm-callout{background:var(--amber-pale);color:var(--amber-dark);border-radius:10px;padding:10px 12px;font-size:12.5px;font-weight:600;line-height:1.5}
.hcm-remind{min-height:200px;font-size:13.5px}
.hcm-facts{display:grid;gap:6px}
.hcm-fact{display:flex;justify-content:space-between;gap:12px;font-size:13px}
.hcm-fact span{color:var(--text-muted)}
.hcm-fact strong{font-weight:650;color:var(--text);text-align:right;overflow-wrap:anywhere}
.hcm-statement{display:flex;flex-direction:column;border:1px solid var(--border);border-radius:12px;overflow:hidden}
.hcm-srow{display:grid;grid-template-columns:64px minmax(0,1fr) auto;gap:4px 10px;align-items:center;min-height:44px;background:none;border:0;border-bottom:1px solid var(--border);padding:8px 12px;font:inherit;font-size:12.5px;text-align:left;cursor:pointer;color:var(--text)}
.hcm-srow:last-child{border-bottom:0}
.hcm-srow span:nth-child(3),.hcm-srow span:nth-child(4){grid-column:2;color:var(--text-muted)}
.hcm-srow strong{grid-column:3;grid-row:1;text-align:right;font-variant-numeric:tabular-nums}
.hcm-toast{position:fixed;left:50%;bottom:84px;transform:translateX(-50%);z-index:1300;display:flex;align-items:center;gap:12px;max-width:min(560px,calc(100vw - 24px));background:var(--brand-ink-deep);color:#fff;padding:10px 12px 10px 16px;border-radius:14px;box-shadow:var(--shadow-lg);font-size:13.5px;font-weight:650}
.hcm-toast .hcm-btn{background:var(--toast-accent);color:var(--on-soft);border:0}

/* Phone: one column, everything full width, room for the bottom tab bar. */
@media (max-width:768px){
  .money-wrap{padding:10px 12px 96px}
  .hcm-title{font-size:20px}
  .hcm-actions .hcm-btn{flex:1 1 auto}
  .hcm-age{grid-template-columns:96px minmax(0,1fr) auto}
  .hcm-split{grid-template-columns:minmax(0,1fr) 96px}
  .hcm-split .hcm-btn{grid-column:1/-1}
  .hcm-toast{bottom:76px}
}
/* Laptop: wider grids, the sheet in the middle of the screen. */
@media (min-width:769px){
  .money-wrap{padding:20px 24px 48px}
  .hcm-tiles{grid-template-columns:repeat(5,minmax(0,1fr))}
  .hcm-buckets{grid-template-columns:repeat(5,minmax(0,1fr))}
  .hcm-overlay{align-items:center;padding:24px}
  .hcm-sheet{max-width:600px;border-radius:var(--radius-2xl);max-height:88vh}
  .hcm-pick{grid-template-columns:repeat(3,minmax(0,1fr))}
  .hcm-row{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);column-gap:16px}
  .hcm-row-top{grid-column:1/-1}
  .hcm-toast{bottom:28px}
}
@media (min-width:1150px){.hcm-toast{left:calc(50% + 116px)}}
/* The Money button's count in the phone's bottom tab bar (under 1150px): the
   same small corner badge the Sales button has (sales.css), so the count
   never sits on a line of its own under the word Money and the bar stays as
   low as before. */
@media (max-width:1149px){
  #vt-money{position:relative}
  #vt-money .hcs-navbadge{position:absolute;top:2px;left:calc(50% + 8px);min-width:16px;height:16px;margin:0;padding:0 4px;font-size:10px}
}
