/* Invoice, quotation and receipt makers: one column made for a phone, two columns on a wide screen.
   Logical properties only, so right to left pages mirror by themselves. */
.inv{padding:18px}
.inv [hidden]{display:none!important}
.inv-own{margin:0 0 20px;padding:12px 14px;background:var(--tint);border-radius:12px;font-size:15px;line-height:1.55}
.inv-sec{margin:0 0 26px}
.inv-sec>h2{font-size:19px;margin:0 0 12px;padding-bottom:6px;border-bottom:1px solid var(--line)}
.inv-grid{display:grid;grid-template-columns:1fr;gap:14px}
.inv-f{display:flex;flex-direction:column;gap:5px;min-width:0;border:0;padding:0;margin:0}
.inv-l{font-size:14px;font-weight:700;color:var(--muted);padding:0}
.inv-hint{color:var(--muted);font-size:13px;line-height:1.5}
/* the words of an error, right under the field they are about */
.inv-err{display:block;color:var(--err);font-size:14px;font-weight:700}
.inv-err .l1,.inv-err .l2{display:block}
.inv-err .l2{font-weight:400}
.inv-row>.inv-err{grid-column:1/-1}
/* Nastaliq needs taller lines than the other scripts, or its lines run into each other */
:lang(ur) .inv-hint{line-height:2}
.inv input[type=text],.inv input[type=date],.inv select,.inv textarea{width:100%;min-width:0;min-height:48px;font:inherit;font-size:16px;line-height:1.4;padding:9px 12px;border:1px solid var(--line);border-radius:10px;background:#fff;color:var(--fg)}
.inv textarea{min-height:92px;line-height:1.6;resize:vertical}
.inv input[type=file]{width:100%;min-width:0;min-height:48px;font:inherit;font-size:15px;padding:10px 0}
.inv-logo-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.inv-logo-row input[type=file]{flex:1 1 200px;width:auto}
button.inv-logo-x{flex:none;min-height:48px;padding:8px 16px}
.inv [aria-invalid=true]{border-color:var(--err);outline:2px solid var(--err);outline-offset:0}
.inv .check{display:flex;align-items:center;gap:12px;min-height:48px;font-size:16px;color:var(--fg);cursor:pointer}
.inv .check input{flex:none;width:24px;height:24px;margin:0;accent-color:var(--accent)}
.inv-date{gap:10px}
.inv-own-date .inv-l{font-weight:400;font-size:13px}
.inv-pair{display:grid;grid-template-columns:1fr 124px;gap:8px}

/* items */
#inv-rows{display:flex;flex-direction:column;gap:12px}
/* align-items:end keeps the quantity and price boxes level when one of their labels takes two lines */
.inv-row{display:grid;grid-template-columns:1fr 1fr;align-items:end;gap:12px;padding:12px;border:1px solid var(--line);border-radius:14px;background:var(--soft)}
.inv-row>.wide,.inv-row-head,.inv-amt{grid-column:1/-1}
.inv-row-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.inv-n{display:inline-grid;place-items:center;min-width:30px;height:30px;padding:0 8px;border-radius:999px;background:var(--accent);color:var(--accent-fg);font-weight:700;font-size:14px}
button.inv-del{width:48px;height:48px;padding:0;font-size:26px;line-height:1;border-radius:12px}
.inv-amt{flex-direction:row;align-items:baseline;justify-content:space-between;padding-top:2px}
.inv-amount{font-weight:700;font-size:18px;font-variant-numeric:tabular-nums;unicode-bidi:isolate}
button.inv-add{width:100%;min-height:48px}

/* live totals */
.inv-totals{margin:16px 0 0;padding:4px 16px;background:var(--soft);border:1px solid var(--line);border-radius:14px}
.inv-tr{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px solid var(--line)}
.inv-tr:last-child{border-bottom:0}
.inv-tr dt{margin:0;color:var(--muted);font-size:15px}
.inv-tr dd{margin:0;font-weight:700;font-variant-numeric:tabular-nums;unicode-bidi:isolate;text-align:end}
.inv-tr[data-r=total] dd,.inv-tr[data-r=balance] dd{font-size:20px;color:var(--accent)}
.inv-tr[data-r=total] dt,.inv-tr[data-r=balance] dt{color:var(--fg);font-weight:700}
.inv-note{color:var(--muted);font-weight:400;font-size:13px}

/* colour choice */
.inv-sws{display:flex;flex-wrap:wrap;gap:8px}
.inv-sw{position:relative;display:inline-flex;align-items:center;min-height:48px;padding:0 12px;padding-inline:8px 14px;border:1px solid var(--line);border-radius:999px;background:#fff;cursor:pointer;font-size:15px}
.inv-sw input{position:absolute;opacity:0;top:0;left:0;width:100%;height:100%;margin:0;cursor:pointer}
.inv-dot{width:30px;height:30px;border-radius:50%;flex:none;margin-inline-end:8px;border:3px solid #fff;box-shadow:0 0 0 1px var(--line)}
/* The chosen colour is marked from the radio button itself (the dot and the name follow it), so the mark shows
   on every phone; the tinted pill around it is added where the browser knows :has(). */
.inv-sw input:checked+.inv-dot{box-shadow:0 0 0 3px var(--accent)}
.inv-sw input:checked~.inv-swn{font-weight:700;text-decoration:underline;text-underline-offset:3px}
.inv-sw input:focus+.inv-dot{box-shadow:0 0 0 3px var(--fg)}
.inv-sw:has(input:checked){border-color:var(--accent);background:var(--tint)}
.inv-sw:has(input:checked) .inv-swn{text-decoration:none}
.inv-sw:has(input:focus-visible){outline:2px solid var(--accent);outline-offset:2px}

#inv-go{width:100%;min-height:54px;font-size:18px}
.inv .status{margin-top:12px}

/* Phones from before 2021 (iPhones up to iOS 14.4) do not space the items of a flex row or column with gap.
   They do not know the inset property either, which is how they are told apart here: margins do the spacing. */
@supports not (inset:0){
  .inv-f:not(.inv-amt)>*+*{margin-top:5px}
  .inv-date>*+*{margin-top:10px}
  #inv-rows>*+*{margin-top:12px}
  .inv .check input{-webkit-margin-end:12px;margin-inline-end:12px}
  .inv-sw{margin:0 0 8px;-webkit-margin-end:8px;margin-inline-end:8px}
  .inv-dot{-webkit-margin-end:8px}
  .inv-tr dt{-webkit-padding-end:12px;padding-inline-end:12px}
  .inv-logo-row>*{margin-bottom:8px}
}

@media (min-width:700px){
  .inv{padding:26px 28px}
  .inv-grid{grid-template-columns:1fr 1fr}
  .inv-grid>.wide{grid-column:1/-1}
  .inv-row{grid-template-columns:3fr 1fr 1.4fr 1.4fr}
  .inv-row>.wide{grid-column:1/2}
  .inv-row-head{grid-column:1/-1}
  .inv-amt{grid-column:auto;flex-direction:column;align-items:stretch;justify-content:flex-end;gap:5px;padding-top:0;min-height:48px}
  .inv-amount{display:flex;align-items:center;min-height:48px}
  button.inv-add{width:auto;padding-inline:26px}
  #inv-go{width:auto;min-width:280px}
  .inv-totals{max-width:420px;margin-inline-start:auto}
}
