/* Finoice web app: document forms (Create Invoice). Works with finoice-app.css.
   Class names are the ones the page script already uses; only the look is new. */

.form-page .main { padding-bottom: 0; overflow: hidden; }
.form-page .form-head { margin-bottom: 0; }
.form-page .form-head .back-btn { flex: none; width: 34px; height: 34px; color: var(--ink-2); text-decoration: none; }
.form-page .form-head .title { display: flex; align-items: center; gap: 10px; margin: 0; min-width: 0; font-size: 20px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.form-page .action-btns { display: flex; align-items: center; gap: 8px; flex: none; }
.form-page .action-btns .btn svg { width: 14px; height: 14px; margin-left: 2px; }

/* Draft / Approved shown beside the title */
.draft-badge, .approved-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: var(--fs-label); font-weight: 600; letter-spacing: 0; }
.draft-badge { background: rgba(87, 82, 74, .12); color: var(--muted); }
.approved-badge { background: var(--emerald-bg, #e3f2ea); color: var(--emerald); }
.draft-badge::before, .approved-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Save menu */
.save-dropdown-wrap { position: relative; }
.save-dropdown-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px; padding: 6px; border: 1px solid rgba(255, 255, 255, .9); border-radius: 14px; background: rgba(255, 255, 255, .96); box-shadow: 0 12px 30px rgba(30, 42, 74, .16), 0 1px 3px rgba(20, 22, 28, .06); }
.save-dropdown-menu.open { display: block; }
.save-dropdown-menu a { display: block; padding: 8px 12px; border-radius: 9px; color: var(--ink); font-size: var(--fs-small); font-weight: 500; cursor: pointer; white-space: nowrap; }
.save-dropdown-menu a:hover, .save-dropdown-menu a:focus-visible { background: rgba(30, 42, 74, .06); }

/* The form scrolls inside the glass window; the header stays put */
.form-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 0 -24px; padding: 16px 24px 28px; }
.form-card { max-width: 1040px; margin: 0 auto; padding: 22px 24px 24px; }
.glass-app .form-card { border: 0; }

.form-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); gap: 14px; }
.form-grid-2 { margin-top: 14px; }
.form-grid .field { min-width: 0; }
.form-card .field label { display: block; margin-bottom: 6px; color: var(--ink-2); font-size: var(--fs-label); font-weight: 600; }
.form-card input[type="text"], .form-card input[type="date"], .form-card input[type="number"], .form-card select, .form-card textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid rgba(30, 42, 74, .14); border-radius: 10px; background: rgba(255, 255, 255, .85);
  color: var(--ink); font: inherit; font-size: var(--fs-small); font-variant-numeric: tabular-nums; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; }
.form-card textarea { height: auto; min-height: 38px; padding: 9px 12px; line-height: 1.45; resize: none; overflow: hidden; }
.form-card select { padding-right: 28px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2357524a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; background-size: 14px; }
.form-card input:hover, .form-card select:hover, .form-card textarea:hover { border-color: rgba(30, 42, 74, .26); }
.form-card input:focus-visible, .form-card select:focus-visible, .form-card textarea:focus-visible { border-color: #3b6aa5; background: #fff; box-shadow: 0 0 0 3px rgba(59, 106, 165, .18); }
.form-card input::placeholder, .form-card textarea::placeholder { color: #8a847b; }

/* Customer search results (the script writes the rows with inline styles) */
#searchDropdown { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; max-height: 280px; overflow-y: auto; border: 1px solid rgba(255, 255, 255, .9); border-radius: 12px; background: #fff; box-shadow: 0 12px 30px rgba(30, 42, 74, .16), 0 1px 3px rgba(20, 22, 28, .06); }
#searchDropdown > div { font-weight: 500 !important; color: var(--ink); }
#searchDropdown > div:last-child { color: #2f4a80 !important; font-weight: 600 !important; }

/* Line items */
.items-header, .item-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 112px 176px 112px 30px; gap: 8px; align-items: start; }
.items-header { margin-top: 26px; padding: 0 0 8px; border-bottom: 1px solid rgba(30, 42, 74, .1); color: var(--muted); font-size: var(--fs-label); font-weight: 600; }
.items-header .num { text-align: right; padding-right: 12px; }
.item-row { padding: 8px 0; border-bottom: 1px solid rgba(30, 42, 74, .07); }
.item-row .m-input-wrap { min-width: 0; }
.item-row input[type="number"] { text-align: right !important; }
.item-row select.i-tax { width: 100% !important; }
.item-row .total-wrap { display: flex; align-items: center; height: 38px; }
.item-row .i-total { flex: 1; text-align: right !important; padding-right: 12px; font-size: var(--fs-small); font-weight: 600; font-variant-numeric: tabular-nums; }
.item-row .i-remove { width: 30px; height: 38px; border-radius: 8px !important; color: #9a948b !important; font-size: 14px !important; }
.item-row .i-remove:hover { background: var(--red-bg) !important; }
.btn-add-line { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; min-height: 34px; padding: 0 14px; border: 1px dashed rgba(30, 42, 74, .25); border-radius: 999px; background: none; color: var(--ink-2); font: inherit; font-size: var(--fs-small); font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.btn-add-line:hover { border-color: rgba(30, 42, 74, .45); background: rgba(255, 255, 255, .7); color: var(--ink); }
.btn-add-line svg { width: 14px; height: 14px; }

/* Totals */
.totals-section { width: min(320px, 100%); margin: 22px 0 0 auto; }
.total-row, .total-final { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; font-variant-numeric: tabular-nums; }
.total-row { padding: 6px 0; color: var(--ink-2); font-size: var(--fs-small); }
.total-row span:last-child { color: var(--ink); font-weight: 600; }
.total-final { margin-top: 6px; padding-top: 12px; border-top: 1px solid rgba(30, 42, 74, .14); font-size: 15px; font-weight: 600; }
.total-final span:last-child { font-size: 22px; letter-spacing: -.02em; }
.total-row span:last-child::before, .total-final span:last-child::before { content: "$"; }

/* Status message: the script sets the colour inline, so the two states are restyled here */
#statusNote { display: none; position: fixed; left: 50%; bottom: 28px; z-index: 9999; transform: translateX(-50%); padding: 10px 16px; border-radius: 999px; background: var(--navy) !important; color: #fff; font-size: var(--fs-small); font-weight: 500; box-shadow: 0 10px 26px rgba(30, 42, 74, .28); pointer-events: none; white-space: nowrap; }
#statusNote[style*="255, 59, 48"], #statusNote[style*="ff3b30"] { background: var(--red) !important; }

/* New customer dialog */
.nc-overlay { display: none; position: fixed; inset: 0; z-index: 9000; align-items: center; justify-content: center; padding: 20px; background: rgba(252, 246, 240, .5); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.nc-modal { width: min(420px, 100%); padding: 22px; border: 1px solid rgba(255, 255, 255, .9); border-radius: 20px; background: rgba(255, 255, 255, .94); box-shadow: 0 24px 60px rgba(30, 42, 74, .2), 0 2px 6px rgba(20, 22, 28, .06); }
.nc-modal h3 { margin: 0 0 14px; font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.nc-modal label { display: block; margin: 12px 0 6px; color: var(--ink-2); font-size: var(--fs-label); font-weight: 600; }
.nc-modal input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid rgba(30, 42, 74, .14); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-size: var(--fs-small); outline: none; }
.nc-modal input:focus-visible { border-color: #3b6aa5; box-shadow: 0 0 0 3px rgba(59, 106, 165, .18); }
.nc-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.nc-cancel, .nc-save { min-height: 36px; padding: 0 16px; border-radius: 999px; font: inherit; font-size: var(--fs-small); font-weight: 600; cursor: pointer; }
.nc-cancel { border: 1px solid rgba(30, 42, 74, .14); background: #fff; color: var(--ink); }
.nc-save { border: 1px solid transparent; background: linear-gradient(180deg, #2b3b66, var(--navy)); color: #fff; }

/* Narrower windows */
@media (max-width: 1150px) {
  .form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .form-grid .field:first-child { grid-column: 1 / -1; }
  .form-grid-2 > div:empty { display: none; }
  .form-grid-2 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .items-header, .item-row { grid-template-columns: minmax(0, 1fr) 64px 96px 150px 96px 28px; gap: 6px; }
}
@media (max-width: 820px) {
  .form-grid, .form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .items-header { display: none; }
  .item-row { grid-template-columns: repeat(4, minmax(0, 1fr)) 28px; row-gap: 6px; padding: 12px 0; }
  .item-row .i-desc { grid-column: 1 / -1; }
  .form-page .form-head .btn-gen { padding: 0 12px; }
  .form-card { padding: 16px; }
  .form-scroll { margin: 0 -16px; padding: 12px 16px 24px; }
}
.item-row .i-total::before { content: "$"; }

/* ===== Pop-up mode (?embed=1): the page sits inside the dashboard's glass window, so it drops its own chrome ===== */
.embed-close { display: none; }
html.embed, html.embed body { background: transparent !important; }
html.embed .silkbg, html.embed .side, html.embed .side-rail, html.embed .acct, html.embed .back-btn { display: none !important; }
html.embed .shell { position: static; inset: auto; display: block; height: 100vh; border: 0; border-radius: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; overflow: visible; }
html.embed .main { height: 100vh; padding: 0 20px; }
html.embed .form-head { margin: 0 -20px; padding: 14px 18px 10px; border: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
html.embed .form-head .title { font-size: 18px; }
html.embed .embed-close { display: grid; flex: none; width: 34px; height: 34px; border-color: rgba(30, 42, 74, .1); background: rgba(255, 255, 255, .8); }
html.embed .form-scroll { margin: 0 -20px; padding: 4px 20px 24px; border-top: 1px solid rgba(30, 42, 74, .08); }
html.embed .form-card { max-width: none; padding: 16px 2px 8px; border: 0; background: none; box-shadow: none; }

/* Line items: every box in a row is the same 38px height. The description grows with its text on its own
   (field-sizing), so the page script's fixed 46px minimum no longer makes it taller than the boxes beside it. */
.item-row textarea.i-desc { padding: 8px 12px; line-height: 20px; }
@supports (field-sizing: content) { .item-row textarea.i-desc { field-sizing: content; height: auto !important; min-height: 38px; } }
@supports not (field-sizing: content) { .item-row .m-input-wrap input, .item-row .m-input-wrap select, .item-row .total-wrap, .item-row .i-remove { height: 46px; } }
.item-row .i-remove { width: 100%; }

/* ===== Audit pass (2026-11-19) ===== */
/* Fields: two rows of four columns. Customer takes two; "Amounts are" sits at the right, above the amount column. */
.form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .field:first-child { grid-column: span 2; }
.form-grid .field-mode { grid-column: 4; }
@media (max-width: 1150px) { .form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .form-grid .field:first-child { grid-column: span 2; } }
@media (max-width: 820px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .field:first-child { grid-column: 1 / -1; } .form-grid .field-mode { grid-column: auto; } }
/* Header actions match the home page: 38px, one filled button */
.form-page .action-btns .btn, html.embed .embed-close { min-height: 38px; height: 38px; }
html.embed .embed-close { width: 38px; }
.form-page .action-btns .btn { padding: 0 16px; }
.form-page .action-btns .btn-ghost { background: transparent; border-color: rgba(30, 42, 74, .18); }
.form-page .action-btns .btn-ghost:hover { background: rgba(255, 255, 255, .7); border-color: rgba(30, 42, 74, .3); }
@media (max-width: 820px) { .form-page .action-btns .btn { padding: 0 12px; } .form-page .action-btns .btn-gen { display: none; } }
/* Money with thousands separators: the element keeps its plain text for the script; data-fmt is what shows */
.item-row .i-total[data-fmt], .total-row span[data-fmt], .total-final span[data-fmt] { font-size: 0 !important; }
.item-row .i-total[data-fmt]::before { content: "$" attr(data-fmt); font-size: var(--fs-small); }
.total-row span[data-fmt]::before { content: "$" attr(data-fmt); font-size: var(--fs-small); }
.total-final span[data-fmt]::before { content: "$" attr(data-fmt); font-size: 22px; }
/* Remove line: a drawn icon like the close button */
.item-row .i-remove { display: grid; place-items: center; padding: 0; border: 0; background: none; cursor: pointer; transition: background .15s, color .15s; }
.item-row .i-remove svg { width: 15px; height: 15px; }
.item-row .i-remove:hover, .item-row .i-remove:focus-visible { color: var(--red) !important; }
/* Add line: a normal outline button (dashed borders are not used anywhere else) */
.btn-add-line { border-style: solid; border-color: rgba(30, 42, 74, .18); }
.btn-add-line:hover { border-color: rgba(30, 42, 74, .32); }
/* Field messages */
.form-card input.invalid, .nc-modal input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(179, 38, 30, .14); }
.field-err { margin: 6px 0 0; color: var(--red); font-size: var(--fs-label); font-weight: 600; line-height: 1.3; }
.save-dropdown-menu a:focus-visible { outline: 2px solid #3b6aa5; outline-offset: -2px; }

/* Save: one split button. Left part saves and approves; the arrow opens the other ways to save. */
.save-split { display: inline-flex; align-items: stretch; }
.form-page .action-btns .save-split .btn-approve { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 14px; }
.form-page .action-btns .save-split .btn-save { width: 36px; padding: 0; justify-content: center; border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid rgba(255, 255, 255, .28); }
.form-page .action-btns .save-split .btn-save svg { width: 15px; height: 15px; margin: 0; }
.save-split .save-dropdown-menu { min-width: 100%; }

/* Save split button, second pass: it is drawn as ONE button. The wrapper carries the fill, shadow and hover lift;
   the two halves are transparent, so they can never separate, lift on their own, or show a seam between them. */
.save-split { position: relative; border-radius: 999px; background: linear-gradient(180deg, #2b3b66 0%, var(--navy) 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(20, 22, 28, .2), 0 6px 16px rgba(30, 42, 74, .22); transition: transform .15s, box-shadow .2s; }
.save-split:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 2px 4px rgba(20, 22, 28, .2), 0 10px 22px rgba(30, 42, 74, .28); }
.form-page .action-btns .save-split .btn, .form-page .action-btns .save-split .btn:hover, .form-page .action-btns .save-split .btn:active { background: transparent; box-shadow: none; transform: none; border-color: transparent; color: #fff; overflow: visible; }
.form-page .action-btns .save-split .btn-approve { border-radius: 999px 0 0 999px; padding: 0 12px 0 18px; }
.form-page .action-btns .save-split .btn-save { border-radius: 0 999px 999px 0; width: 34px; padding: 0 4px 0 0; border-left: 0; }
.form-page .action-btns .save-split .btn:hover { background: rgba(255, 255, 255, .1); }
.form-page .action-btns .save-split .btn:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
/* A short hairline marks where the arrow starts; it does not run the full height, so the pill stays whole */
.form-page .action-btns .save-split .btn-save::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 1px; background: rgba(255, 255, 255, .3); }
@media (prefers-reduced-motion: reduce) { .save-split, .save-split:hover { transition: none; transform: none; } }

/* Save is a single button again (no split, no divider). Its menu lists the three ways to save, the usual one first. */
.form-page .action-btns .btn-save { padding: 0 14px 0 18px; gap: 6px; }
.form-page .action-btns .btn-save svg { width: 15px; height: 15px; margin: 0; }
.save-dropdown-menu a.is-main { font-weight: 700; }

/* Save draft and Approve are two buttons with different names; only Approve is filled. */
.form-page .action-btns .btn-approve { padding: 0 20px; }
/* Message after a save, with the "Add another" action */
#finToast { position: fixed; left: 50%; bottom: 28px; z-index: 9999; display: flex; align-items: center; gap: 14px; transform: translate(-50%, 8px); padding: 10px 12px 10px 18px; border-radius: 999px; background: var(--navy); color: #fff; font-size: var(--fs-small); font-weight: 600; box-shadow: 0 10px 26px rgba(30, 42, 74, .28); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
#finToast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#finToast:not(:has(button)) { padding-right: 18px; }
#finToast button { min-height: 28px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, .45); border-radius: 999px; background: transparent; color: #fff; font: inherit; font-size: var(--fs-label); font-weight: 600; cursor: pointer; }
#finToast button:hover { background: rgba(255, 255, 255, .14); }
#finToast button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { #finToast { transition: none; transform: translate(-50%, 0); } }

/* ===== Actions in a footer bar: under the total, fixed while the form scrolls ===== */
.form-page .form-foot { display: flex; align-items: center; gap: 8px; flex: none; margin: 0 -24px; padding: 12px 24px; border-top: 1px solid rgba(30, 42, 74, .1); background: rgba(255, 255, 255, .5); }
.form-page .form-foot .spacer { flex: 1 1 auto; }
html.embed .form-foot { margin: 0 -20px; padding: 12px 20px; background: rgba(252, 249, 245, .9); }
.form-scroll { padding-bottom: 20px; }
html.embed .form-scroll { padding-bottom: 16px; }
@media (max-width: 820px) { .form-page .form-foot { margin: 0 -16px; padding: 10px 16px; } .form-page .action-btns .btn-gen { display: inline-flex; } }
/* Messages sit above the footer bar, not on top of its buttons */
#finToast, #statusNote { bottom: 78px; }
.foot-total { margin-right: 8px; color: var(--ink-2); font-size: var(--fs-small); font-weight: 500; white-space: nowrap; }
.foot-total[hidden] { display: none; }
.foot-total b { margin-left: 6px; color: var(--ink); font-size: 16px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

/* Less empty space around the footer line: the total sits closer to it, and the bar itself is a little shorter */
.form-scroll { padding-bottom: 8px; }
html.embed .form-scroll { padding-bottom: 8px; }
html.embed .form-card { padding-bottom: 2px; }
.totals-section { margin-top: 16px; }
.form-page .form-foot, html.embed .form-foot { padding-top: 10px; padding-bottom: 10px; }

/* ---------- Quote form (Quotation.html): customer at the left with the details that will print; number, reference and
   dates at the right; tax and discount beside the totals they change ---------- */
.quote-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 14px 22px; align-items: start; }
.qh-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cust-info { margin-top: 8px; padding: 9px 12px; border: 1px solid rgba(30, 42, 74, .1); border-radius: 10px; background: rgba(30, 42, 74, .03); color: var(--ink-2); font-size: var(--fs-small); line-height: 1.5; overflow-wrap: anywhere; }
.cust-info[hidden] { display: none; }
.quote-lower { display: grid; grid-template-columns: minmax(0, 1fr) min(340px, 100%); gap: 28px; align-items: start; margin-top: 16px; }
.quote-side { min-width: 0; }
.qs-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.disc-combo { display: flex; gap: 6px; }
.form-card .disc-combo input { flex: 1 1 auto; min-width: 0; text-align: right; }
.form-card .disc-combo select { flex: none; width: 62px; }
.quote-side .totals-section { width: auto; margin: 0; }
.notes-grid { display: grid; gap: 12px; min-width: 0; }
.form-card .notes-grid textarea { width: 100%; resize: vertical; overflow: auto; }
.total-row.discount span[data-fmt]::before { content: "\2212$" attr(data-fmt); }
.total-row.discount:has(span[data-fmt="0.00"]) { display: none; }
.form-foot .btn[hidden] { display: none; }
@media (max-width: 820px) { .quote-head, .quote-lower { grid-template-columns: minmax(0, 1fr); } }

/* Save As menu (quote form): opens upward from the footer button */
.save-as { position: relative; }
.save-as .btn .i { width: 14px; height: 14px; margin-left: 6px; }
.save-as-menu { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 30; min-width: 208px; padding: 6px; border: 1px solid rgba(30, 42, 74, .12); border-radius: 12px; background: #fff; box-shadow: 0 12px 32px rgba(30, 42, 74, .16); display: grid; gap: 2px; }
.save-as-menu[hidden] { display: none; }
.save-as-menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 12px 0 34px; position: relative; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: var(--fs-small); font-weight: 500; text-align: left; white-space: nowrap; cursor: pointer; }
.save-as-menu button:hover, .save-as-menu button:focus-visible { background: rgba(30, 42, 74, .07); outline: none; }
.save-as-menu button[aria-checked="true"] { font-weight: 600; }
.save-as-menu button[aria-checked="true"]::before { content: ""; position: absolute; left: 13px; top: 50%; width: 10px; height: 5px; margin-top: -5px; border-left: 2px solid var(--navy); border-bottom: 2px solid var(--navy); transform: rotate(-45deg); }

/* An empty discount box shows a grey 0; it goes while the box is being typed in, so the caret is not beside a 0 */
.form-card .disc-combo input:focus::placeholder { color: transparent; }

/* Customer details under the customer box: one labelled line each */
.cust-info { display: grid; gap: 6px; padding: 10px 12px; line-height: 1.45; }
.cust-info[hidden] { display: none; }
.ci-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.ci-l { color: var(--muted); font-size: var(--fs-label); font-weight: 600; }
.ci-v { color: var(--ink); white-space: pre-line; overflow-wrap: anywhere; }
.ci-none { color: var(--muted); }

/* Invoice form: the same head as the quote form; tax mode and totals at the right under the lines */
.inv-lower { display: flex; justify-content: flex-end; margin-top: 16px; }
.inv-lower .quote-side { width: min(340px, 100%); }
.qs-controls.one { grid-template-columns: minmax(0, 1fr); }

/* ---------- Bill form (Create_Bill.html, 22 Nov 2026): the New Invoice layout, plus the supplier's bill beside it ---------- */
.bill-form .form-scroll { min-width: 0; }
.bill-split { flex: 1 1 auto; min-height: 0; display: flex; gap: 0; }
.bill-split > .form-scroll { flex: 1 1 auto; }
.bill-doc { flex: none; width: 400px; margin: 0 16px 0 -4px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.bill-doc[hidden] { display: none; }
.bd-view { flex: 1 1 auto; min-height: 320px; border-radius: 12px; background: rgba(30, 42, 74, .05); overflow: hidden; display: grid; place-items: center; }
.bd-view iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.bd-view img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; }
.bd-view:has(.bd-pages) { display: block; overflow: auto; }
.bd-pages { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px; }
.bd-pages canvas { display: block; background: #fff; border-radius: 4px; box-shadow: 0 1px 3px rgba(20, 22, 28, .12); }
.bd-wait { margin: 0; color: var(--muted); font-size: var(--fs-small); }
.bd-bar { display: flex; align-items: center; gap: 10px; font-size: var(--fs-label); color: var(--ink-2); }
.bd-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bd-link { border: 0; background: none; padding: 0; color: var(--navy); font: inherit; font-weight: 600; cursor: pointer; }
.bd-link:hover { text-decoration: underline; }
/* With the file beside the form, supplier and its details stay on the left and the bill fields on the right (no longer stacked full width) */
.bill-items { width: 100%; margin-top: 16px; border-collapse: collapse; table-layout: fixed; }
.bill-items th { padding: 0 6px 8px; color: var(--ink-2); font-size: var(--fs-label); font-weight: 600; text-align: left; border-bottom: 1px solid rgba(30, 42, 74, .1); }
.bill-items th.num { text-align: right; }
.bill-items td { padding: 7px 3px; vertical-align: top; border-bottom: 1px solid rgba(30, 42, 74, .06); }
.bill-items .c-acc { width: 15%; } .bill-items .c-qty { width: 64px; } .bill-items .c-price { width: 96px; } .bill-items .c-tax { width: 15%; } .bill-items .c-amt { width: 96px; } .bill-items .c-del { width: 30px; }
.bill-items input, .bill-items select, .bill-items textarea { width: 100%; height: 36px; padding: 0 9px; border: 1px solid rgba(30, 42, 74, .14); border-radius: 9px; background: #fff; color: var(--ink); font: inherit; font-size: var(--fs-small); box-sizing: border-box; }
.bill-items textarea { padding: 8px 9px; line-height: 20px; resize: none; overflow: hidden; }
.bill-items .i-qty, .bill-items .i-price { text-align: right; }
.bill-items td.c-amt { padding-top: 15px; text-align: right; font-size: var(--fs-small); font-weight: 600; font-variant-numeric: tabular-nums; }
.bill-items .i-total:not(:empty)::before { content: "$"; }
.bill-items .btn-del-row { width: 28px; height: 28px; margin-top: 4px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.bill-items .btn-del-row:hover { background: rgba(30, 42, 74, .07); color: var(--ink); }
.bill-items .btn-del-row .i { width: 14px; height: 14px; }
.bill-lower { display: grid; grid-template-columns: minmax(0, 1fr) min(320px, 100%); gap: 24px; align-items: start; margin-top: 16px; }
.bill-lower .totals-section { grid-column: 2; width: auto; margin: 0; }
.bill-drop { justify-self: start; width: min(280px, 100%); display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; border: 1px dashed rgba(30, 42, 74, .28); border-radius: 12px; background: rgba(255, 255, 255, .55); color: var(--ink-2); line-height: 1.3; cursor: pointer; transition: border-color .15s, background-color .15s; }
.bill-drop[hidden] { display: none; }
.bill-drop:hover, .bill-drop.drag-over { border-color: var(--navy); border-style: solid; background: #fff; }
.bill-drop:focus-within { outline: 2px solid var(--navy); outline-offset: 2px; }
.bill-drop .bd-ico { flex: none; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: rgba(30, 42, 74, .06); }
.bill-drop .i { width: 18px; height: 18px; color: var(--navy); stroke-width: 1.8; }
.bill-drop .bd-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bill-drop small { font-size: var(--fs-label); color: var(--muted); }
.bill-drop u { text-decoration: none; color: var(--navy); font-weight: 600; }
.bill-drop b { display: block; color: var(--ink); font-size: var(--fs-small); font-weight: 600; }
.bill-form .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 1000px) { .bill-split { flex-direction: column; } .bill-doc { width: auto; height: 360px; margin: 0 0 12px; } }

/* Bill lines: the description box grows with its text (and never stays tall when the form gets wider) */
@supports (field-sizing: content) { .bill-items textarea.i-desc { field-sizing: content; height: auto !important; min-height: 36px; } }
/* With a file beside it, the form is at least tall enough for one whole A4 page of the file (400px column: page 543px + padding),
   so the window grows to show the full page instead of cutting it off */
body.has-doc .form-card { min-height: 590px; }
@media (max-width: 1000px) { body.has-doc .form-card { min-height: 0; } }
/* Customer / supplier search list (finPick in finoice-form.js) */
#searchDropdown.fin-pick { padding: 6px; border: 1px solid rgba(30, 42, 74, .1); }
.fin-pick .fp-opt { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.fin-pick .fp-opt.on { background: rgba(30, 42, 74, .06); }
.fin-pick .fp-av { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(30, 42, 74, .08); color: var(--navy); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.fin-pick .fp-tx { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.fin-pick .fp-tx b { font-size: var(--fs-small); font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-pick .fp-tx small { font-size: var(--fs-label); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-pick .fp-none { padding: 10px 8px; color: var(--muted); font-size: var(--fs-small); }
.fin-pick .fp-new { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 9px 8px 7px; border-top: 1px solid rgba(30, 42, 74, .08); border-radius: 0 0 8px 8px; color: var(--navy); font-size: var(--fs-small); font-weight: 600; cursor: pointer; }
.fin-pick .fp-new.on { background: rgba(30, 42, 74, .06); border-radius: 8px; }
.fin-pick .fp-new .i { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }
/* Our pop-up list for <select> boxes (finoice-form.js), in place of the system menu */
.fin-select { position: fixed; z-index: 1000; min-width: 180px; max-width: 360px; overflow-y: auto; padding: 6px; border: 1px solid rgba(30, 42, 74, .1); border-radius: 12px; background: #fff; box-shadow: 0 12px 30px rgba(30, 42, 74, .16), 0 1px 3px rgba(20, 22, 28, .06); font-size: var(--fs-small); color: var(--ink); }
.fin-select .fs-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.fin-select .fs-opt span { overflow: hidden; text-overflow: ellipsis; }
.fin-select .fs-opt.on { background: rgba(30, 42, 74, .06); }
.fin-select .fs-opt.sel { font-weight: 600; }
.fin-select .fs-opt .i { flex: none; width: 15px; height: 15px; stroke: var(--navy); stroke-width: 2.2; fill: none; }
.fin-select .fs-add { color: var(--navy); font-weight: 600; }
.fin-select .fs-add span::before { content: "+"; display: inline-block; width: 14px; margin-right: 4px; font-weight: 700; }
.fin-select .fs-grp { padding: 8px 10px 4px; color: var(--muted); font-size: var(--fs-label); font-weight: 600; }
/* New / Edit Receipt (Create_Receipt.html): iOS fields in order, amount with "Price includes GST", file beside the form */
.rc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.rc-grid .rc-2 { grid-column: span 2; }
.rc-grid .rc-full { grid-column: 1 / -1; }
.rc-grid .opt { color: var(--muted); font-weight: 500; }
.receipt-form .bill-lower { margin-top: 18px; }
.rc-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rc-amt { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.rc-amt .field { width: 180px; }
.rc-amt #vAmt { text-align: right; font-variant-numeric: tabular-nums; }
.rc-switch { display: inline-flex; align-items: center; gap: 10px; height: 38px; color: var(--ink); font-size: var(--fs-small); font-weight: 500; cursor: pointer; }
.rc-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rc-switch .sw { position: relative; flex: none; width: 36px; height: 21px; border-radius: 999px; background: rgba(30, 42, 74, .2); transition: background-color .15s; }
.rc-switch .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.rc-switch input:checked + .sw { background: var(--navy); }
.rc-switch input:checked + .sw::after { transform: translateX(15px); }
.rc-switch input:focus-visible + .sw { outline: 2px solid #3b6aa5; outline-offset: 2px; }
.rc-hints:empty { display: none; }
.rc-hints p { margin: 0; padding: 9px 12px; border-radius: 10px; background: rgba(238, 179, 92, .14); color: #7a5214; font-size: var(--fs-small); line-height: 1.45; }
.rc-hints p + p { margin-top: 6px; }
.receipt-form .form-foot .rc-del { color: var(--red); }
.rc-msg { color: var(--muted); font-size: var(--fs-small); }
.rc-msg.bad { color: var(--red); }
@media (max-width: 700px) { .rc-grid { grid-template-columns: minmax(0, 1fr); } .rc-grid .rc-2 { grid-column: auto; } }
.bd-view:has(.bd-pages) { overflow-x: hidden; }
.bill-form .form-foot .bill-del { color: var(--red); }

/* ---------- New / Edit Receipt, layout A (owner, 24 Nov 2026): the receipt on the left, the form on the right ---------- */
.receipt-form .bill-split { padding-left: 0; }
.receipt-form .rc-drop { flex: none; align-self: stretch; width: 280px; margin: 4px 20px 18px 0; flex-direction: column; justify-content: center; gap: 10px; padding: 20px; border-width: 1.5px; border-radius: 16px; text-align: center; }
.receipt-form .rc-drop .bd-ico { width: 44px; height: 44px; border-radius: 12px; }
.receipt-form .rc-drop .i { width: 20px; height: 20px; }
.receipt-form .rc-drop .bd-txt { align-items: center; gap: 3px; }
.receipt-form .rc-drop b { font-size: 14px; }
.receipt-form .bill-doc { margin: 4px 20px 18px 0; }
/* The form column must not slide under the receipt: no negative margin on this side, and a clear 20px gap */
html.embed .receipt-form .bill-split > .form-scroll, .receipt-form .bill-split > .form-scroll { margin-left: 0; padding-left: 0; padding-top: 0; border-top: 0; }
/* the line under the title runs across the whole window, above both columns */
html.embed .receipt-form .bill-split { border-top: 1px solid rgba(30, 42, 74, .08); padding-top: 4px; }
html.night.embed .receipt-form .bill-split { border-top-color: rgba(255, 255, 255, .11); }
html.embed .receipt-form .form-card, .receipt-form .form-card { padding-top: 4px; padding-left: 0; }
/* The amount comes first, with what it splits into beside it */
.rc-amtcard { padding: 14px 16px 12px; border: 1px solid rgba(30, 42, 74, .1); border-radius: 14px; background: rgba(255, 255, 255, .6); }
.rc-amt-top { display: flex; align-items: flex-end; gap: 18px; }
.rc-amt-in { width: 200px; }
.receipt-form .rc-amt-in input#vAmt { height: 48px; font-size: 22px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.rc-sum { display: flex; gap: 22px; margin-left: auto; padding-bottom: 4px; text-align: right; font-variant-numeric: tabular-nums; }
.rc-sum > div { display: grid; gap: 2px; }
.rc-sum span { color: var(--muted); font-size: var(--fs-label); font-weight: 600; }
.rc-sum b { color: var(--ink); font-size: 15px; font-weight: 700; }
.rc-sum b::before { content: "$"; }
.rc-sum b[data-fmt] { font-size: 0; }
.rc-sum b[data-fmt]::before { content: "$" attr(data-fmt); font-size: 15px; }
.rc-sum .rc-sum-t b[data-fmt]::before { font-size: 18px; font-weight: 800; }
.rc-amtcard .rc-switch { height: auto; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(30, 42, 74, .08); width: 100%; align-items: flex-start; }
.rc-amtcard .rc-switch .sw { margin-top: 1px; }
.rc-sw-t { display: grid; gap: 1px; font-weight: 600; }
.rc-sw-t small { color: var(--muted); font-size: var(--fs-label); font-weight: 500; }
.receipt-form .rc-hints { margin-top: 12px; }
.receipt-form .rc-grid { margin-top: 16px; }
@media (max-width: 1000px) { .receipt-form .bill-split { padding: 0 20px; } .receipt-form .rc-drop { width: auto; margin: 0 0 12px; flex-direction: row; justify-content: flex-start; text-align: left; } .receipt-form .rc-drop .bd-txt { align-items: flex-start; } }
@media (max-width: 640px) { .rc-amt-top { flex-wrap: wrap; } .rc-sum { margin-left: 0; } }
/* Reading a PDF receipt: a line above the amount, and the fields it filled marked until edited */
.rc-scan { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; font-size: var(--fs-small); font-weight: 600; }
.rc-scan[hidden] { display: none; }
.rc-scan.busy { background: rgba(30, 42, 74, .05); color: var(--ink-2); }
.rc-scan.ok { background: rgba(31, 122, 87, .1); color: #17634a; }
.rc-scan.warn { background: rgba(238, 179, 92, .14); color: #7a5214; }
.receipt-form input.scanned { border-color: rgba(31, 122, 87, .55); background: rgba(31, 122, 87, .05); }
