/* invoice.css: the Invoices tab composer, the form beside the paper it fills in (2026-11-01). Byte copy in every brand hub
   (tools/sync-finance-model.mjs); tokens only, so it holds in each hub's look and in light and dark.
   DIRECTION a receipt laid beside the form that is copying it. SIGNATURE the paper's folded corner. Motion: none. */
.inv-composer{ display:grid; grid-template-columns:minmax(0,1fr); gap:16px; margin-bottom:24px; align-items:start; }
@media(min-width:1100px){
  .inv-composer{ grid-template-columns:minmax(0,1.2fr) minmax(320px,.8fr); }
  .inv-composer.no-paper{ grid-template-columns:minmax(0,1fr); }
  .inv-paper{ position:sticky; top:96px; }
}
.inv-composer.no-paper .inv-paper{ display:none; }
.inv-composer .inv-form{ display:block; margin:0; padding:20px; border:1px solid var(--line); border-radius:12px; background:var(--card); }
.ic-sec + .ic-sec{ margin-top:20px; padding-top:20px; border-top:1px solid var(--line); }
.ic-head{ display:flex; flex-wrap:wrap; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:14px; }
.ic-title{ margin:0; font-size:15px; font-weight:500; letter-spacing:-.01em; color:var(--ink); }
.ic-sub{ margin:2px 0 0; font-size:12px; color:var(--muted); }
.ic-tools{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.ic-fields{ display:grid; grid-template-columns:minmax(0,1fr); gap:12px; }
@media(min-width:560px){ .ic-fields{ grid-template-columns:repeat(2,minmax(0,1fr)); } .ic-wide{ grid-column:1/-1; } }
.ic-f{ display:flex; flex-direction:column; gap:5px; min-width:0; font-size:12px; color:var(--muted); }
.ic-f .exp-in{ width:100%; flex:none; min-height:38px; border-radius:8px; box-sizing:border-box; }
.inv-composer .inv-kinds{ margin:0 0 14px; }
.inv-composer .inv-imgs{ margin:0 0 14px; }
.inv-composer .inv-confirm{ margin:0 0 12px; }
.inv-composer .inv-lines{ margin:0; gap:0; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.inv-composer .inv-line{ padding:7px 8px; gap:6px; border-top:1px solid var(--line); margin:0; }
.inv-composer .inv-line .exp-in{ border-radius:6px; min-width:0; width:100%; box-sizing:border-box; }
.inv-composer .inv-line-head{ border-top:0; background:var(--hoverbg); text-transform:none; letter-spacing:0; font-size:12px; }
.inv-composer .inv-line-head span:nth-child(5){ text-align:end; }
.inv-composer .inv-lines .pl-empty{ padding:16px 12px; margin:0; border-top:1px solid var(--line); }
.ic-lines-foot{ display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-top:10px; }
.ic-lines-foot .exp-cancel{ border-radius:8px; }
.ic-lines-foot .inv-hint{ margin:0; }
.inv-composer .inv-sum{ display:block; margin-top:10px; }
.ic-actions{ display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; margin-top:20px; }
.ic-actions button{ border-radius:8px; min-height:40px; }
.inv-scan-btn{ border-radius:8px; cursor:pointer; }
.ic-toggle{ display:none; border-radius:8px; }
@media(min-width:1100px){ .ic-toggle{ display:inline-block; } }

.ip-sheet{ position:relative; padding:24px 22px 22px; border:1px solid var(--line); border-radius:4px; background:var(--card); color:var(--ink);
  clip-path:polygon(0 0,calc(100% - 22px) 0,100% 22px,100% 100%,0 100%); }
.ip-sheet::after{ content:""; position:absolute; top:-1px; inset-inline-end:-1px; width:22px; height:22px; background:var(--line); clip-path:polygon(0 0,0 100%,100% 100%); }
[dir="rtl"] .ip-sheet{ clip-path:polygon(22px 0,100% 0,100% 100%,0 100%,0 22px); }
.ip-top{ display:flex; align-items:baseline; justify-content:space-between; gap:10px; padding-inline-end:18px; margin-bottom:16px; }
.ip-title{ margin:0; font-size:24px; font-weight:500; letter-spacing:-.02em; }
.ip-kind{ font-size:12px; color:var(--muted); }
.ip-meta{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 16px; margin:0 0 18px; }
.ip-meta dt{ font-size:12px; color:var(--muted); }
.ip-meta dd{ margin:2px 0 0; font-size:13px; font-weight:500; overflow-wrap:anywhere; }
.ip-table{ width:100%; border-collapse:collapse; font-size:13px; margin-bottom:14px; }
.ip-table th{ text-align:start; font-size:12px; font-weight:400; color:var(--muted); padding:0 0 8px; border-bottom:1px solid var(--line); }
.ip-table td{ padding:9px 0; border-bottom:1px solid var(--line); vertical-align:top; }
.ip-table .ip-n{ text-align:end; white-space:nowrap; font-variant-numeric:tabular-nums; padding-inline-start:12px; }
.ip-item{ overflow-wrap:anywhere; }
.ip-code{ display:block; font-size:11px; color:var(--muted); }
.ip-none{ margin:0 0 14px; padding:18px 0; font-size:13px; color:var(--muted); border-block:1px solid var(--line); }
.ip-sums{ display:grid; gap:7px; font-size:13px; }
.ip-sum{ display:flex; justify-content:space-between; gap:12px; color:var(--muted); }
.ip-sum > span:last-child{ font-variant-numeric:tabular-nums; color:var(--ink); }
.ip-total{ font-weight:500; color:var(--ink); padding-top:8px; border-top:1px solid var(--line); font-size:15px; }
.ip-due > span:last-child, .ip-warn > span:last-child{ color:var(--red); }
.ip-note{ margin:12px 0 0; font-size:12px; color:var(--muted); overflow-wrap:anywhere; }
@media(max-width:760px){ .ic-f .exp-in{ font-size:16px; } .inv-composer .inv-form{ padding:16px; } .ip-sheet{ padding:20px 16px 18px; } }
.ip-credit > span:last-child{ color:var(--pos); }

/* The reworked Invoices tab and supplier page (finance.js invoicesHomeHTML / supplierPageHTML, 2026-12-04, from the
   Supplexon demo). Hub tokens only. Copied to Yeganen and Defragile and harvested into Figi Trade by the syncs. */
.iv-head{ display:flex; align-items:center; justify-content:space-between; gap:16px; margin:0 0 16px; }
.iv-lead{ margin:0; color:var(--muted); font-size:14px; max-width:640px; line-height:1.5; }
.iv-new{ white-space:nowrap; }
.iv-kpis{ grid-template-columns:repeat(4,1fr); }
.iv-kpi-warn{ border-color:color-mix(in srgb, var(--red) 45%, var(--line)); }
.iv-neg{ color:var(--red); }

/* the status pills: one look for the three states, everywhere */
.iv-pill{ display:inline-flex; align-items:center; gap:4px; padding:3px 9px; border-radius:999px; font-size:12px; font-weight:500; white-space:nowrap; line-height:1.4; }
.iv-pill.paid{ color:var(--pos); background:color-mix(in srgb, var(--pos) 13%, transparent); }
.iv-pill.part{ color:#d99a1e; background:rgba(217,154,30,.14); }
.iv-pill.unpaid{ color:var(--red); background:var(--red-tint, rgba(255,90,31,.12)); }

/* paid vs total */
.iv-bar{ display:block; height:6px; border-radius:999px; background:var(--red-tint, rgba(255,90,31,.14)); overflow:hidden; margin:8px 0 2px; }
.iv-bar i{ display:block; height:100%; border-radius:inherit; background:var(--pos); }

/* supplier avatars */
.iv-ava{ flex:none; display:inline-grid; place-items:center; width:38px; height:38px; border-radius:11px; font-size:13px; font-weight:600; letter-spacing:.02em;
  color:var(--ink); background:var(--at-track); border:1px solid var(--line); }
.iv-ava.sm{ width:26px; height:26px; border-radius:8px; font-size:10.5px; }
.iv-ava.lg{ width:56px; height:56px; border-radius:16px; font-size:19px; }

/* the supplier cards */
.iv-addsup{ display:flex; gap:6px; }
.iv-addsup .exp-in{ width:200px; }
.iv-cards{ display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:12px; }
.iv-card{ position:relative; padding:14px; border:1px solid var(--line); border-radius:14px; background:var(--card); transition:border-color .15s, transform .15s; }
.iv-card:hover{ border-color:color-mix(in srgb, var(--ink) 30%, var(--line)); transform:translateY(-1px); }
.iv-card.owes{ border-color:color-mix(in srgb, var(--red) 35%, var(--line)); }
.iv-card-open{ position:absolute; inset:0; z-index:0; border:0; background:none; cursor:pointer; border-radius:inherit; }
.iv-card-open:focus-visible{ outline:2px solid var(--red); outline-offset:2px; }
.iv-card > :not(.iv-card-open){ position:relative; z-index:1; pointer-events:none; }
.iv-card .vend-del{ pointer-events:auto; }
.iv-card-top{ display:flex; align-items:center; gap:10px; }
.iv-card-name{ flex:1; min-width:0; }
.iv-card-name b{ display:block; font-size:14px; font-weight:600; line-height:1.25; }
.iv-card-name span{ display:block; font-size:12px; color:var(--muted); }
.iv-card-num{ display:flex; align-items:baseline; justify-content:space-between; margin-top:14px; font-size:12px; color:var(--muted); }
.iv-card-num b{ font-size:19px; font-weight:600; color:var(--ink); font-variant-numeric:tabular-nums; }
.iv-card-num small{ font-size:11px; font-weight:400; color:var(--muted); }
.iv-card-foot{ display:flex; justify-content:space-between; font-size:12px; color:var(--muted); }
.iv-card-empty{ margin-top:12px; font-size:12.5px; color:var(--muted); }

/* who we owe */
.iv-owed-total{ font-weight:600; color:var(--red); font-variant-numeric:tabular-nums; }
.iv-owe{ padding:10px 0; border-top:1px solid var(--rowline, var(--line)); }
.iv-owe:first-of-type{ border-top:0; }
.iv-owe-row{ display:flex; align-items:center; gap:12px; }
.iv-owe-name{ flex:1; min-width:0; display:flex; flex-direction:column; }
.iv-owe-name .lnk{ font-weight:600; text-align:start; }
.iv-owe-name span{ font-size:12px; color:var(--muted); }
.iv-owe-row b{ font-variant-numeric:tabular-nums; }

/* the invoices table */
.iv-search{ width:min(340px, 100%); }
.iv-table td{ vertical-align:middle; }
.iv-row{ cursor:pointer; }
.iv-row:hover td{ background:var(--hoverbg, var(--at-track)); }
.iv-row:focus-visible{ outline:2px solid var(--red); outline-offset:-2px; }
.iv-row.open td{ background:var(--at-track); }
.iv-row.st-unpaid .iv-date{ box-shadow:inset 3px 0 0 var(--red); }
.iv-row.st-part .iv-date{ box-shadow:inset 3px 0 0 #d99a1e; }
.iv-date{ white-space:nowrap; color:var(--muted); }
.iv-who{ display:inline-flex; align-items:center; gap:8px; font-weight:500; }
.iv-no{ font-size:12px; color:var(--muted); }
.iv-items{ font-size:12.5px; color:var(--muted); }
.iv-items span{ display:block; color:var(--muted); font-size:12px; max-width:280px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.iv-caret{ width:22px; color:var(--muted); text-align:center; }
.iv-kind{ display:inline-block; font-size:11.5px; font-weight:500; padding:2px 8px; border-radius:6px; background:var(--at-track); }
.iv-kind-products{ color:#5b8def; background:rgba(91,141,239,.13); }
.iv-kind-packaging{ color:#b78a3a; background:rgba(183,138,58,.14); }
.iv-kind-other{ color:var(--muted); }
.iv-more{ text-align:center; padding:10px 0 2px; }
.iv-detail > td{ padding:0 !important; background:var(--at-track); }
.iv-det{ display:grid; grid-template-columns:1fr 300px; gap:18px; padding:14px 16px 18px; }
.iv-lines{ width:100%; border-collapse:collapse; font-size:13px; }
.iv-lines th{ text-align:start; font-size:10.5px; text-transform:uppercase; letter-spacing:.8px; color:var(--muted); font-weight:500; padding:6px 8px; border-bottom:1px solid var(--line); }
.iv-lines td{ padding:6px 8px; border-bottom:1px solid var(--rowline, var(--line)); }
.iv-lines .num, .iv-table .num{ text-align:end; font-variant-numeric:tabular-nums; }
.iv-det-money{ display:flex; flex-direction:column; gap:6px; padding:12px; border-radius:12px; background:var(--card); border:1px solid var(--line); align-self:start; }
.iv-sum{ display:flex; justify-content:space-between; font-size:13px; }
.iv-sum b{ font-variant-numeric:tabular-nums; }
.iv-sum.due b{ color:var(--red); }
.iv-sum.fee{ color:var(--muted); }
.iv-pays{ list-style:none; margin:6px 0 0; padding:8px 0 0; border-top:1px solid var(--line); display:flex; flex-direction:column; gap:6px; font-size:12px; }
.iv-pays li{ display:grid; grid-template-columns:52px 1fr auto auto; gap:6px; align-items:center; color:var(--muted); }
.iv-pays b{ color:var(--ink); font-variant-numeric:tabular-nums; }
.iv-pays .pay-void{ border:0; background:none; color:var(--muted); cursor:pointer; padding:2px; }
.iv-det-actions{ display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-top:8px; }
.iv-det-actions .lnk{ margin-inline-start:auto; font-size:12.5px; }
.iv-det .inv-pay-form{ margin-top:6px; }

/* New invoice: the form alone, as three steps */
.iv-formbar{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin:0 0 14px; flex-wrap:wrap; }
.iv-steps{ display:flex; gap:6px; margin:0; padding:0; list-style:none; counter-reset:ivs; }
.iv-steps li{ counter-increment:ivs; display:flex; align-items:center; gap:7px; font-size:12.5px; color:var(--muted); padding:5px 11px 5px 6px; border-radius:999px; background:var(--at-track); }
.iv-steps li::before{ content:counter(ivs); display:grid; place-items:center; width:20px; height:20px; border-radius:50%; background:var(--red); color:#fff; font-size:11px; font-weight:600; }
#inv-form{ counter-reset:ics; }
#inv-form .ic-sec:not([hidden]) .ic-title{ counter-increment:ics; display:flex; align-items:center; gap:8px; }
#inv-form .ic-sec:not([hidden]) .ic-title::before{ content:counter(ics); display:grid; place-items:center; width:22px; height:22px; border-radius:50%; background:var(--red); color:#fff; font-size:12px; font-weight:600; flex:none; }
.iv-kind-hint{ margin:6px 0 12px; font-size:12.5px; color:var(--muted); }
.iv-kind-hint b{ color:var(--ink); font-weight:500; }

/* the supplier page */
.sp-head{ display:flex; align-items:center; gap:14px; margin:12px 0 18px; }
.sp-title{ flex:1; min-width:0; }
.sp-title h2{ margin:0; font-size:26px; font-weight:600; letter-spacing:-.01em; }
.sp-title span{ font-size:13px; color:var(--muted); }
.sp-grid{ display:grid; grid-template-columns:minmax(280px, 1fr) 2fr; gap:18px; align-items:start; }
.sp-grid .panel, .sup-page > .panel{ margin-bottom:18px; }
.iv-legend{ display:flex; align-items:center; gap:6px; font-size:12px; color:var(--muted); }
.iv-legend i{ width:10px; height:10px; border-radius:3px; display:inline-block; }
.iv-legend i.p, .iv-col-bar i.p{ background:var(--pos); }
.iv-legend i.o, .iv-col-bar i.o{ background:var(--red); }
.iv-chart{ display:flex; align-items:flex-end; gap:10px; height:190px; padding-top:18px; }
.iv-col{ flex:1; height:100%; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; gap:5px; min-width:0; }
.iv-col-bar{ width:100%; max-width:46px; min-height:3px; display:flex; flex-direction:column; border-radius:7px 7px 3px 3px; overflow:hidden; }
.iv-col-bar i{ display:block; min-height:0; }
.iv-col-v{ font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; }
.iv-col-m{ font-size:11.5px; color:var(--muted); }
.iv-up{ color:var(--red); font-size:12.5px; font-weight:500; }
.iv-down{ color:var(--pos); font-size:12.5px; font-weight:500; }
.iv-same{ color:var(--muted); font-size:12.5px; }

@media (max-width:1100px){ .iv-kpis{ grid-template-columns:repeat(2,1fr); } .sp-grid{ grid-template-columns:1fr; } .iv-det{ grid-template-columns:1fr; } }
@media (max-width:700px){
  .iv-head{ flex-direction:column; align-items:stretch; }
  .iv-addsup .exp-in{ width:140px; }
  .iv-table th.iv-items-h, .iv-table td.iv-items{ display:none; }
  .sp-head{ flex-wrap:wrap; }
  .sp-title{ flex:1 1 calc(100% - 80px); }
  .sp-title h2{ font-size:22px; }
  .sp-head .iv-new-for{ flex:1 1 100%; }
  .iv-steps li{ font-size:11.5px; }
}
@media (prefers-reduced-motion:reduce){ .iv-card{ transition:none; } .iv-card:hover{ transform:none; } }
/* FigiHome's model has credits (paid, then pieces never came), receipt photos and never-came lines */
.iv-pos{ color:var(--pos); }
.iv-pill.credit{ color:var(--pos); background:color-mix(in srgb, var(--pos) 13%, transparent); }
.iv-sum.credit b{ color:var(--pos); }
.iv-never td{ color:var(--muted); font-size:12px; font-style:italic; }
.iv-clip{ display:inline-flex; align-items:center; gap:2px; color:var(--muted); }
.iv-clip svg{ width:13px; height:13px; }
.tbl-wrap{ overflow-x:auto; }
/* each supplier's own invoices under his total in Who we owe; search count; paid-from and by-month on his page */
.iv-owe-invs{ display:flex; flex-wrap:wrap; gap:6px; margin:8px 0 0 38px; }
.iv-owe-inv{ font:inherit; font-size:12px; color:var(--muted); background:var(--at-track); border:1px solid var(--line); border-radius:999px; padding:3px 10px; cursor:pointer; }
.iv-owe-inv:hover{ border-color:color-mix(in srgb, var(--ink) 30%, var(--line)); }
.iv-owe-inv b{ font-weight:500; font-variant-numeric:tabular-nums; }
.iv-hits{ font-size:13px; color:var(--muted); margin:0 0 8px; }
.iv-bits{ display:flex; flex-wrap:wrap; gap:6px 16px; align-items:baseline; font-size:12.5px; color:var(--muted); margin:-6px 0 18px; }
.iv-bits b{ color:var(--ink); font-weight:500; font-variant-numeric:tabular-nums; }
.iv-months{ margin-top:14px; }
.iv-aya{ font-size:12.5px; font-weight:500; margin-inline-end:4px; }
@media (max-width:700px){ .iv-owe-invs{ margin-inline-start:0; } }
