/* Karen: Invoices to chase (accounts.js). Built on the shared parts in styles.css (the Leads template):
   .vhead, .search, .tabs, .list/.lrow and the KarenPop pop-up. Only what's this page's own is here. */

/* The page: header, search, tabs and list stacked with one rhythm */
.acpage { display: flex; flex-direction: column; gap: 20px; }
.acpage > .msg:empty, .acpage > .acnote:empty { display: none; }
.acpage .tabs { margin-bottom: -8px; }
details.more.acmore > summary::after { content: none; }
.acmore .menu { min-width: 260px; }
.acmore .menu a { text-decoration: none; color: var(--ink); }

/* Brand dot (used by the reminder emails) */
.bdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; flex: none; background: var(--muted); }
.bdot.b-wt { background: #1E4A3D; } .bdot.b-c2u { background: #560F1C; } .bdot.b-ed { background: #8A3A0E; } .bdot.b-none { background: var(--input); }

/* Rows: the reply link and the picking box sit inside the shared row */
.aclist .lrow-who > span a { color: var(--green-700); font-weight: 600; text-decoration: none; }
.aclist .lrow-who > span .t-err { color: var(--red); font-weight: 600; }
.aclist .arpick { display: inline-flex; align-items: center; margin-right: 10px; vertical-align: -3px; }
.aclist .lrow-act:is(span):empty { display: none; }

/* The open customer (pop-up, or in place on My day) */
.acpop { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.acgo { align-items: center; }
.acgo .link { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }
.acnophone { margin: 0; }
.acopts { display: flex; flex-wrap: wrap; gap: 8px; }
.acopts .btn.on { background: var(--green-100); border-color: var(--green-700); color: var(--green-900); }
.acform { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--divider); padding-top: 12px; }
.acform label.l, .acform span.l, .accall .l { margin: 10px 0 6px; display: block; font-size: 13px; font-weight: 600; color: var(--grey-ink); }
.acform > label.l:first-child, .acform > span.l:first-child { margin-top: 0; }
.acform textarea, .acform input[type=text] { width: 100%; box-sizing: border-box; }
.acform .acabout { margin-top: 8px; }
.acform .acabout .check { margin-top: 4px; }
.acform .handfaces { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.acform .handnote { max-width: 420px; }
.accall { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--divider); padding-top: 12px; }
.accall .l:first-child { margin-top: 0; }
.acoutform input[type=text] { max-width: 420px; width: 100%; }

/* Inside the fold: age as one line, then one row per invoice with its ⋮ */
.acinvs { display: flex; flex-direction: column; gap: 0; }
.acage { margin: 0 0 8px; font-size: 14px; color: var(--grey-ink); font-variant-numeric: tabular-nums; }
.acinv { display: grid; grid-template-columns: 96px minmax(0, 1fr) 110px 130px 44px; gap: 4px 12px; align-items: center; padding: 6px 0; border-top: 1px solid var(--divider); font-size: 14px; min-width: 0; }
.acinv:first-of-type, .acage + .acinv { border-top: 0; }
.acinv.sel { background: var(--green-100); margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
.acinv.later { color: var(--muted); }
.acinv > * { min-width: 0; }
.acinv-n { font-family: var(--mono); font-size: 13px; font-weight: 600; white-space: nowrap; }
.acinv-ref { overflow-wrap: anywhere; color: var(--grey-ink); }
.acinv-ref em { font-style: normal; color: var(--amber); font-weight: 600; }
.acinv-ref small { display: block; font-size: 13px; color: var(--muted); }
.acinv-amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acinv-days { color: var(--grey-ink); white-space: nowrap; }
.acinv-days.late { color: var(--red); font-weight: 600; }
.acinv-more > summary.btn { width: 40px; min-width: 40px; min-height: 40px; padding: 0; justify-content: center; font-size: 18px; }
details.more.acinv-more > summary::after { content: none; }
.acinv-more .menu { min-width: 220px; }
.acinv-more .menu button[aria-pressed="true"] { font-weight: 700; }
.acinvs > [data-invall] { align-self: flex-start; margin-top: 6px; min-height: 40px; }
/* Recording a payment (admins, once switched on): the form opens under the invoice */
.acinv .acpay { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; padding: 12px 0 4px; }
.acinv .acpay .two { max-width: 420px; }
.acinv .acpay .rowbtns { margin-top: 2px; }
.acinv .acpay .note { font-size: 13px; color: var(--muted); margin: 0; }
.acinv .acpay input { height: 40px; min-width: 0; }
.acphone, .achist { display: flex; flex-direction: column; gap: 4px; }
.acphone .l, .achist .l { font-size: 13px; font-weight: 600; color: var(--grey-ink); margin-top: 6px; }
.acphone .ph { display: inline-flex; gap: 12px; align-items: center; font-size: 15px; font-variant-numeric: tabular-nums; }
.acphone .hint, .achist .hint { margin: 0; }

/* Bulk reminder emails: the picking bar (ar-email.js draws it above the list) */
.arpickbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; background: var(--green-100); border-radius: 12px; padding: 8px 12px 8px 16px; }
.arpickbar .btn, .arpickbar .link { min-height: 44px; }

@media (max-width: 720px) {
  .acinv { grid-template-columns: minmax(0, 1fr) auto 44px; }
  .acinv-n { grid-column: 1; grid-row: 1; }
  .acinv-amt { grid-column: 2; grid-row: 1; }
  .acinv-more { grid-column: 3; grid-row: 1 / span 2; }
  .acinv-ref { grid-column: 1; }
  .acinv-days { grid-column: 2; text-align: right; }
  .acinv .acpay .two { max-width: none; }
  .acinv .acpay input, .acinv .acpay .btn { min-height: 44px; }
  .acgo .link { flex: 1 1 100%; justify-content: center; }
}

/* Invoices to chase, like Xero's list: a toolbar, then one line per invoice with a tick box (accounts.js) */
.actool { margin: 4px 0 10px; }
.actool[hidden], .acbatch[hidden] { display: none; }
.actool-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actool-bar .btn { min-height: 40px; }
.acneed { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; min-height: 40px; font-size: 13px; color: var(--muted); cursor: pointer; }
.acneed input { width: 18px; height: 18px; margin: 0; accent-color: var(--green-700); }
.acsel { color: var(--muted); font-size: 13px; margin-left: 4px; }
.acsum { margin-left: auto; color: var(--muted); font-size: 13px; }
.acbatch { margin-top: 10px; }
.acbp { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.acbp .l { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.acbp input[type="text"] { width: 100%; box-sizing: border-box; }
.acbp-go { display: flex; align-items: center; gap: 12px; }
.acfoot { margin: 10px 0 0; font-size: 13px; }

.aclist .actbl { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: 14px; }
.actbl thead th { position: sticky; top: 56px; z-index: 2; height: 40px; padding: 0 12px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
.actbl .acsort { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.actbl .acsort:hover, .actbl .acsort:focus-visible { color: var(--ink); }
.actbl td { padding: 10px 12px; border-top: 1px solid var(--divider); vertical-align: middle; }
.actbl tbody tr:first-child td { border-top: 0; }
.actbl .ack { width: 40px; padding-right: 0; }
.actbl .ack input { width: 18px; height: 18px; margin: 0; vertical-align: middle; accent-color: var(--green-700); }
.actbl .acn { width: 11%; white-space: nowrap; }
.actbl .acr { width: 17%; max-width: 180px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actbl .acu { width: 22%; }
.actbl .acu b { font-weight: 600; }
.actbl .acd { width: 9%; white-space: nowrap; }
.actbl .aco { width: 10%; white-space: nowrap; }
.actbl .acl { width: 19%; color: var(--muted); }
.actbl .acm { width: 12%; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.actbl th.acm { text-align: right; }
.actbl .late { color: var(--red); font-weight: 600; }
.actbl tr.aci { cursor: pointer; }
.actbl tr.aci:hover { background: var(--ground); }
.actbl tr.aci.cur { background: var(--green-100); }
.actbl tr.aci:focus-visible { outline: 2px solid var(--green-700); outline-offset: -2px; }
.actbl .acl .t-err, .actbl small.acsm .t-err { color: var(--red); font-weight: 600; }
.actbl .acl a, .actbl small.acsm a { color: var(--green-700); font-weight: 600; text-decoration: none; }
.actbl small.acsm { display: none; margin-top: 2px; color: var(--muted); font-size: 13px; white-space: normal; }

@media (max-width: 900px) {
  .actbl .acn, .actbl .acr, .actbl .acd, .actbl .acl { display: none; }
  .actbl small.acsm { display: block; }
  .actbl .acu { width: auto; }
  .actbl .aco { width: 20%; }
  .acbp { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .actbl td { padding: 10px 8px; }
  .actbl .ack { width: 34px; }
  .actbl .aco { width: 24%; white-space: normal; }
  .actool-bar .btn { flex: 1 1 28%; padding-left: 8px; padding-right: 8px; }
  .acneed { margin-left: 0; }
  .acsel, .acsum { flex: 1 1 100%; margin: 0; }
  .actbl thead th { top: 0; }
}

.actbl .acstar { color: var(--muted); font-weight: 600; margin-right: 2px; }

/* Invoices that couldn't be sent: above the list, one row each with the email box (accounts.js) */
.acprob { margin: 0 0 16px; }
.acprob[hidden] { display: none; }
.acprob .hint { margin: 0 0 8px; }
.acprob-list { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.acprob-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 4px 16px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--divider); }
.acprob-row:first-child { border-top: 0; }
.acprob-who b { font-weight: 600; margin-right: 8px; }
.acprob-who .bdot { margin-right: 6px; }
.acprob-who small { display: block; margin-top: 2px; color: var(--amber); font-size: 13px; }
.acprob-act { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.acprob-act label { flex: 1 1 220px; min-width: 0; }
.acprob-act .btn { min-height: 40px; }
.acprob-row .msg { grid-column: 1 / -1; margin: 0; }
.acprob-row .msg:empty { display: none; }
@media (max-width: 720px) {
  .acprob-row { grid-template-columns: 1fr; padding: 12px; }
  .acprob-act .arrevin { min-height: 44px; }
  .acprob-act .btn { min-height: 44px; }
}
