/* css/views/invoices.css — AP workbench (js/views/invoices.js), the project Invoices tab (.pinv) and the small
   V5 building blocks shared by the supplier portal, Command Center and Hive Map (.v5k KPI strip, .v5sor system
   badge, .v5chain P2P chain, .v5cite policy chip). Red = action/danger, crimson = identity, blue = positive. */

/* ---------- shared: KPI strip (one bordered row, 3px identity bar, reference 4.3) ---------- */
.v5k { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--surface); border-radius: var(--r-lg); border-top: 3px solid var(--brand); box-shadow: var(--shadow); margin: 0 0 22px; overflow: hidden; }
.v5k-c { padding: 15px 18px 14px; border-left: 1px solid var(--line); min-width: 0; text-align: left; font: inherit; color: inherit; background: transparent; }
.v5k-c:first-child { border-left: 0; }
.v5k .k { display: flex; align-items: center; gap: 7px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--mut2); font-weight: 600; }
.v5k .k .i { width: 13px; height: 13px; }
.v5k .v { font-family: var(--mono); font-size: 25px; font-weight: 600; color: var(--ink); margin-top: 5px; line-height: 1.15; }
.v5k .v.red { color: var(--red-d); } .v5k .v.emph { color: var(--emph); } .v5k .v.blue { color: var(--bblue); }
.v5k .s { font-size: 12.5px; color: var(--mut); margin-top: 4px; }
.v5k .s a { color: var(--bblue); font-weight: 600; }

/* ---------- shared: system-of-record badge ---------- */
.v5sor { display: inline-flex; align-items: center; gap: 4px; font: 600 10px var(--mono); letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line2); color: var(--mut); background: var(--surface); white-space: nowrap; }
.v5sor small { font: 500 10px var(--sans); letter-spacing: 0; text-transform: none; color: var(--mut2); }
.v5sor-ariba { border-color: #C9D7E8; color: var(--bblue); }
.v5sor-sap { border-color: #CDD9D7; color: var(--teal-d); }
.v5sor-servicenow { border-color: #D9D1C4; color: var(--graphite); }
.v5sor-nest { border-color: var(--brand-2); color: var(--brand); }
.v5sor + .v5sor { margin-left: 5px; }

/* ---------- shared: policy citation chip ---------- */
.v5cite { font: 600 10px var(--mono); letter-spacing: .03em; color: var(--mut2); background: var(--nested); border-radius: 20px; padding: 2px 8px; white-space: nowrap; cursor: help; }

/* ---------- shared: P2P chain strip ---------- */
.v5chain { display: flex; align-items: stretch; gap: 6px; margin: 0 0 18px; flex-wrap: wrap; }
.v5cn { flex: 1 1 150px; min-width: 140px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); border-top: 3px solid var(--line2); position: relative; color: var(--ink); }
a.v5cn:hover { box-shadow: var(--shadow-2); }
.v5cn-k { font: 600 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--mut2); }
.v5cn b { font-size: 13px; }
.v5cn small { font-size: 11.5px; color: var(--mut); }
.v5cn .v5sor { position: absolute; top: 8px; right: 8px; }
.v5cn.done { border-top-color: var(--bblue); }
.v5cn.part { border-top-color: var(--teal-d); }
.v5cn.warn { border-top-color: var(--emph); }
.v5cn.bad { border-top-color: var(--red); background: linear-gradient(0deg, var(--surface), var(--surface)), var(--pink-t); }
.v5cn.bad b { color: var(--red-d); }
.v5cn.todo { background: rgba(255,255,255,.55); box-shadow: none; border: 1px dashed var(--line2); border-top: 3px dashed var(--line2); }
.v5cn.todo b { color: var(--mut3); }
.v5cn-arrow { display: flex; align-items: center; color: var(--mut3); }

/* ---------- AP queue ---------- */
.inv .page-head { align-items: flex-end; }
.inv .head-sors { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; padding-bottom: 4px; }
.inv-tabs { margin-bottom: 16px; }
.inv-toolbar .search-pill { min-width: 330px; }
.countline { font-size: 12.5px; margin: 0 0 10px; }
.inv-row { color: var(--ink); }
.inv-row .emph { color: var(--emph); font-weight: 600; }
.inv-row .late { color: var(--red-d); }
.inv-row.is-guided { box-shadow: inset 3px 0 0 var(--brand); }
.inv-row .sors { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.inv-detail { font-size: 13px; }
.more-row { display: flex; justify-content: center; padding: 14px 0 0; }
.foot-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(255,255,255,.5); font-size: 12.5px; color: var(--mut); }
.foot-note .i { color: var(--mut2); flex: none; margin-top: 2px; }
.tbl-row.is-new { background: var(--blue-t); }

/* payment run */
.run-hd { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 18px; }
.run-title { font-size: 20px; font-weight: 800; margin: 4px 0 2px; }
.run-total { text-align: right; }
.run-total .big { font-size: 26px; font-weight: 600; color: var(--bblue); }

/* ---------- invoice detail ---------- */
.crumb { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--mut); margin-top: 4px; }
.crumb:hover { color: var(--ink); }
.inv-head h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.inv-head h1 .mono { font-size: 28px; letter-spacing: -.01em; }
.inv-head .page-sub a { color: var(--bblue); font-weight: 600; }
.inv-grid { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 20px; align-items: start; }
.inv-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.inv-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 16px; }
.amt3 { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); border-top: 3px solid var(--brand); overflow: hidden; }
.amt3 > div { padding: 12px 14px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.amt3 > div:first-child { border-left: 0; }
.amt3 b { font-size: 16px; }
.amt3 b.blue { color: var(--bblue); } .amt3 b.red { color: var(--red-d); }
.inv-kv > div { grid-template-columns: 92px 1fr; }
.inv-kv em.paused { font-style: normal; color: var(--emph); font-weight: 700; }
.elpis-expl { margin: 0; background: var(--surface); border: 1.6px solid var(--blue-2); border-radius: 15px; padding: 12px 15px; box-shadow: var(--shadow); }
.elpis-expl .pcard-hd, .compose-card .pcard-hd { display: flex; justify-content: space-between; align-items: center; padding: 0 0 6px; }
.elpis-expl { border-top: 1.6px solid var(--blue-2); }
.elpis-expl .eyebrow { font: 600 10.5px var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ai); }
.elpis-expl .eyebrow { display: inline-flex; align-items: center; gap: 6px; }
.elpis-expl .md p { margin: 0 0 6px; font-size: 13.5px; line-height: 1.55; }

/* three-way match */
.match-card .card-hd { align-items: center; }
.mgrid { display: grid; grid-template-columns: minmax(0,1fr) 54px minmax(0,1fr) 54px minmax(0,1fr); align-items: stretch; margin: 6px 0 14px; }
.mdoc { border: 1.5px solid var(--line2); border-radius: 12px; padding: 12px 13px 10px; background: var(--soft2); min-width: 0; }
.mdoc.has-bad { border-color: var(--red); background: #FFF8F7; }
.mdoc.missing { border-style: dashed; background: rgba(255,255,255,.6); }
.mdoc-hd { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.mdoc-id { font-size: 13px; font-weight: 600; margin: 3px 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.mrow .k { color: var(--mut); }
.mrow .v { text-align: right; overflow-wrap: anywhere; }
.mrow .v.txt { font-size: 12.5px; }
.mrow.bad { background: var(--pink-t); margin: 0 -13px; padding: 5px 13px; border-top-color: var(--pink-2); }
.mrow.bad .v { color: var(--red-d); font-weight: 700; }
.mnote { font-size: 12px; color: var(--mut); margin-top: 6px; }
.mlink { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; }
.mlink-svg { width: 54px; height: 24px; position: absolute; top: calc(50% - 20px); }
.mlink-svg path { stroke: var(--bblue); stroke-width: 2; fill: none; }
.mlink.bad .mlink-svg path { stroke: var(--red); stroke-dasharray: 4 3; }
.mlink-dot { position: relative; width: 24px; height: 24px; border-radius: 50%; background: var(--bblue); color: #fff; font: 700 13px var(--mono); display: flex; align-items: center; justify-content: center; margin-top: -16px; }
.mlink.bad .mlink-dot { background: var(--red); box-shadow: 0 0 0 4px var(--pink-t); }
.mlink small { font: 600 9px var(--mono); letter-spacing: .04em; color: var(--mut2); margin-top: 4px; text-transform: uppercase; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 12px 0 10px; }
.check { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: start; padding: 8px 10px; border-radius: 10px; background: var(--ok-bg); }
.check.bad { background: var(--danger-bg); }
.check .ck { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bblue); color: #fff; margin-top: 1px; }
.check.bad .ck { background: var(--red); }
.check .ck .i { width: 12px; height: 12px; stroke-width: 3; }
.check .cl b { display: block; font-size: 13px; }
.check .cl small { display: block; font-size: 12px; color: var(--mut); margin-top: 1px; }
.check.bad .cl b { color: var(--red-d); }
.tolerance { background: var(--nested); border-radius: 10px; padding: 10px 13px; }
.tolerance p { margin: 4px 0 0; font-size: 12.5px; color: var(--mut); }
.match-card .callout { margin-bottom: 4px; }

/* timeline */
.itl { list-style: none; margin: 4px 0 0; padding: 0; position: relative; }
.itl-i { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 9px 0; position: relative; align-items: start; }
.itl-i::before { content: ""; position: absolute; left: 7px; top: 22px; bottom: -9px; width: 2px; background: var(--line2); }
.itl-i:last-child::before { display: none; }
.itl-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--bblue); margin-top: 2px; box-shadow: 0 0 0 3px var(--surface); position: relative; z-index: 1; }
.itl-i.done::before { background: var(--bblue); }
.itl-i.flag .itl-dot { background: var(--red); }
.itl-i.now .itl-dot { background: var(--surface); border: 3px solid var(--teal-d); }
.itl-i.blocked .itl-dot { background: var(--surface); border: 3px solid var(--red); }
.itl-i.next .itl-dot { background: var(--surface); border: 2px dashed var(--mut3); }
.itl-i.next b { color: var(--mut2); }
.itl-b b { font-size: 13.5px; }
.itl-b small { display: block; font-size: 12px; color: var(--mut); margin-top: 1px; }
.itl-m { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; color: var(--mut); }

/* actions */
.act-card .acts { display: flex; flex-direction: column; gap: 9px; align-items: stretch; }
.act-btn { justify-content: space-between; white-space: normal; text-align: left; }
.act-btn[aria-disabled="true"] { background: var(--nested); color: var(--mut3); border: 1.5px dashed var(--line2); }
.act-btn[aria-disabled="true"] .tag { opacity: .6; }
.release-wrap { display: flex; flex-direction: column; gap: 5px; }
.release-wrap .btn { width: 100%; }
.release-wrap small { font-size: 12px; }
.act-done { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--bblue); font-weight: 600; padding: 4px 2px; }
.act-done .i { width: 14px; height: 14px; stroke-width: 3; }
.compose-card .draft-meta { margin: 6px 0 10px; }
.compose-body { width: 100%; min-height: 210px; font-size: 13.5px; }
.compose-card .pcard-ft { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.tk-card .card-hd { align-items: center; }
.tk { display: grid; grid-template-columns: 82px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.tk small { display: block; font-size: 11.5px; color: var(--mut2); }
.tk.closed { opacity: .75; }
.side-links { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; }
.side-links a { display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-size: 13px; font-weight: 600; color: var(--ink); border-radius: 8px; }
.side-links a:hover { background: var(--bg); }

/* ---------- project Invoices tab ---------- */
.pinv { display: flex; flex-direction: column; gap: 16px; padding: 18px 22px 40px; }
.pinv-hd { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.pinv-po .card-hd h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pinv-po .v5chain { margin: 4px 0 12px; }
.pinv-po .callout { margin-bottom: 12px; }
.pinv-lines { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pinv-invs { margin-top: 10px; display: flex; flex-direction: column; }
.pinv-inv { display: grid; grid-template-columns: 110px auto 1fr auto; gap: 12px; align-items: center; padding: 8px 2px; border-top: 1px solid var(--line); font-size: 13px; }
.pinv-inv a { color: var(--bblue); font-weight: 600; }
.pinv-inv .money { font-weight: 600; }
.pinv-steps { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line2); display: flex; flex-direction: column; gap: 8px; }
.row.wrap { flex-wrap: wrap; }

@media (max-width: 1180px) {
  .inv-grid { grid-template-columns: 1fr; }
  .inv-side { position: static; }
  .v5k { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .mgrid { grid-template-columns: 1fr; gap: 8px; }
  .mlink { display: none; }
  .checks { grid-template-columns: 1fr; }
}

/* chain inside the narrow project pane */
.pinv .v5chain { flex-wrap: nowrap; gap: 4px; }
.pinv .v5cn { flex: 1 1 0; min-width: 0; padding: 8px 9px; }
.pinv .v5cn .v5sor { display: none; }
.pinv .v5cn b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinv .v5cn small { font-size: 11px; }
.pinv .v5cn-arrow .i { width: 12px; height: 12px; }
.pinv-steps .act-done { padding: 6px 4px; }
