/* =============================================================================
   The Total panel, one look in every accounting window (office, 12 Nov 2026:
   "Fix the Total UI in all windows").

   `.acc-tot` is drawn by the invoice, bill, receipt/payment voucher, journal
   voucher, salaries and supplier-deposit forms and by the invoice and bill
   windows. Each placed it a little differently: beside a labelled field without
   lining up with it, stretched across half a window, labelled twice, and with a
   grand total no bigger than the rows above it. Now it is one panel:

   - it sits at the END of its column (right in English, left in Arabic) at one
     width, and its bottom lines up with the input beside it, not its label;
   - every row is label then figure; figures are fixed-width digits that keep
     their sign and digit order in Arabic;
   - the grand total is the largest figure in the window, in the window's own
     colour (a receipt green, a payment red, a journal blue …); a journal's
     difference turns red until it is zero, and a balance still owed is red;
   - a total spelled out in words sits inside the panel, under its figure.

   Its own sheet, not acc-app.css or accounting.css: those two are exported to
   web/. Loaded after them, so its rules win where they meet.
   ============================================================================= */

/* Bottoms line up with the inputs beside it, whatever the panel's height. */
body.acc-fullscreen .accform > .accf:has(> .acc-tot){align-self:end}

body.acc-fullscreen .mdl .acc-tot{
  width:100%;max-width:420px;box-sizing:border-box;
  margin:0;margin-inline-start:auto;margin-inline-end:0;
  border:1px solid var(--acc-line, #d9e0ea);border-radius:12px;overflow:hidden;
  background:var(--acc-surface, #fff);
  box-shadow:0 1px 2px rgba(16,24,40,.05);
}
body.acc-fullscreen .mdl .acc-tot > div{
  display:flex;align-items:baseline;justify-content:space-between;gap:18px;
  padding:9px 14px;border-bottom:1px solid var(--acc-line-soft, #e7ecf3);border-top:0;
  background:transparent;
}
body.acc-fullscreen .mdl .acc-tot > div:last-child{border-bottom:0}
body.acc-fullscreen .mdl .acc-tot > div > span{
  font-size:calc(12.5px * var(--acc-fs, 1));color:var(--acc-ink-soft, #4c5a70);font-weight:500;
}
body.acc-fullscreen .mdl .acc-tot > div > b{
  font-size:calc(14px * var(--acc-fs, 1));font-weight:600;color:var(--acc-ink, #101828);
  font-variant-numeric:tabular-nums;direction:ltr;unicode-bidi:isolate;white-space:nowrap;text-align:end;
}

/* The figure the window exists for. */
body.acc-fullscreen .mdl .acc-tot > .acc-tot__grand{
  align-items:center;padding:12px 14px;
  background:color-mix(in srgb, var(--win-accent, var(--acc-accent)) 7%, var(--acc-surface, #fff));
  border-top:2px solid color-mix(in srgb, var(--win-accent, var(--acc-accent)) 45%, var(--acc-line, #d9e0ea));
}
body.acc-fullscreen .mdl .acc-tot > .acc-tot__grand:first-child{border-top:0}
body.acc-fullscreen .mdl .acc-tot > .acc-tot__grand > span{
  font-size:calc(13px * var(--acc-fs, 1));font-weight:700;color:var(--acc-ink-2, #233043);
}
body.acc-fullscreen .mdl .acc-tot > .acc-tot__grand > b{
  font-size:calc(21px * var(--acc-fs, 1));font-weight:800;letter-spacing:-.01em;line-height:1.15;
  color:var(--win-accent, var(--acc-accent-deep, #c2151c));
}
/* A journal that does not balance: the difference is red, and says so. */
body.acc-fullscreen .mdl .acc-tot > .acc-tot__grand.is-bad{
  background:var(--acc-red-soft, #fef3f2);border-top-color:var(--acc-red, #b42318);
}
body.acc-fullscreen .mdl .acc-tot > .acc-tot__grand.is-bad > b{color:var(--acc-red, #b42318)}
/* A balance still owed is red; one settled is green (the invoice window). */
body.acc-fullscreen .mdl .acc-tot > .acc-tot__grand.is-owed > b{color:var(--acc-red, #b42318)}
body.acc-fullscreen .mdl .acc-tot > .acc-tot__grand.is-settled > b{color:var(--acc-green, #067647)}

/* The total in words, under its figure (receipt and payment vouchers). */
body.acc-fullscreen .mdl .acc-tot > .vch-words{
  display:block;padding:8px 14px 10px;border-top:1px dashed var(--acc-line, #d9e0ea);border-bottom:0;
  font-size:calc(12px * var(--acc-fs, 1));line-height:1.5;color:var(--acc-ink-soft, #4c5a70);
}
body.acc-fullscreen .mdl .acc-tot > .vch-words:empty{display:none}

/* The journal's "does not balance" note sits under the panel, at its width. */
body.acc-fullscreen .mdl .accf:has(> .acc-tot) > .accnote{max-width:420px;margin-inline-start:auto;box-sizing:border-box;width:100%}
body.acc-fullscreen .mdl .accf:has(> .acc-tot) > .accnote:empty{display:none}

/* Phones: the panel takes the width it is given. */
@media (max-width:760px){
  body.acc-fullscreen .mdl .acc-tot{max-width:none}
  body.acc-fullscreen .mdl .accf:has(> .acc-tot) > .accnote{max-width:none}
}
