/* ═══════════════════════════════════════════════════════════════════════
   oms-rd-factory-final.css — the owner's final factory-portal items.

   PO 1   one list for "All merchants" + Customer column   (oms-rdf-po.js)
   PO 2   no message / file counters by the PO #, URGENT inline, the row red
          — the merchant's PO list styling (admin-new.html renderPOs rowStyle)
   PO 3   the PO quick view #fpo-qv (oms-rdf-poqv.js) — the merchant's #po-qv
          rules (oms-rd-admin.css "po-qv"), re-scoped, since the factory does
          not load oms-rd-admin.css; the slide itself is oms-rd-panels.css
   PO 4   the product strip uses the merchant's own blocks; their CSS is
          /css/oms-rd-order-products.css (linked on the factory too). The few
          .pc rules it relies on from oms-rd-admin.css are repeated here.
   PROD 2 buy-price tier cards (oms-rdf-product.js pricingHtml)
   CUST 2 the sub groups pop-up #rdfc-sg-ov (oms-rdf-customers.js)
   Linked after the other factory sheets; bump ?v= on every edit.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── PO 1 + 2: the list ───────────────────────────────────────────────── */
.rd.fpol-rd .fpol-tbl td.fpol-po { white-space: nowrap; width: 1%; }
.rd.fpol-rd .fpol-poline { flex-wrap: nowrap; gap: 6px; }
.rd.fpol-rd .fpol-poline .urgent { flex: none; margin: 0; }
.rd.fpol-rd .fpol-poline .ord-new {
    display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; border: 0;
    background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 800; cursor: pointer; font-family: inherit; flex: none;
}
/* Urgent: the merchant's row — red wash + a 3px red edge. */
.rd.fpol-rd .fpol-tbl tr.fpol-row.is-urgent td { background: #FEE2E2; }
.rd.fpol-rd .fpol-tbl tr.fpol-row.is-urgent td:first-child { box-shadow: inset 3px 0 0 #DC2626; }
.rd.fpol-rd .fpol-tbl tr.fpol-row.is-urgent:hover td { background: #FDD6D6; }
.rd.fpol-rd .fpol-tbl tr.fpol-row.is-urgent.is-sel td,
.rd.fpol-rd .fpol-tbl tr.fpol-row.is-urgent.is-qv td { background: #FCCFCF; }
/* The row open in the quick view (the merchant's tr.sel). */
.rd.fpol-rd .fpol-tbl tr.fpol-row.is-qv td { background: rgba(61,78,232,.07); }
.rd.fpol-rd .fpol-tbl tr.fpol-row.is-qv td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
/* The Customer (merchant) column — All merchants only. */
.rd.fpol-rd .fpol-tbl td.fpol-merch { white-space: nowrap; }
.rd.fpol-rd .fpol-tbl .fpol-merch-n { display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; font-weight: 700; color: var(--ink); }

/* ── PO 3: the quick view ─────────────────────────────────────────────── */
#fpo-qv.po-qv {
    position: fixed; top: 16px; right: 20px; bottom: 16px; width: min(620px, calc(var(--rd-vw, 100vw) - 32px));
    z-index: 900; display: flex; flex-direction: column; overflow: hidden; background: #fff;
    border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 24px 60px -24px rgba(27,32,82,.35); font-size: 14px; color: var(--ink);
}
#fpo-qv.po-qv[hidden] { display: none; }
#fpo-qv .po-qv-h { padding: 16px 20px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 0; }
#fpo-qv .po-qv-h h3 { margin: 0; }
#fpo-qv .fpoqv-acts { gap: 6px; flex: none; }
#fpo-qv .iconbtn { cursor: pointer; }
#fpo-qv .iconbtn:disabled { opacity: .4; cursor: default; }
#fpo-qv .po-qv-tabs { display: flex; gap: 0; padding: 0 20px; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
#fpo-qv .po-qv-tabs button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); padding: 12px; cursor: pointer; white-space: nowrap; box-shadow: none; }
#fpo-qv .po-qv-tabs button:hover { color: var(--ink); }
#fpo-qv .po-qv-tabs button.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
#fpo-qv .po-qv-tabs .c { font-weight: 800; color: var(--muted); margin-left: 2px; }
#fpo-qv .po-qv-b { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1; min-height: 0; }
#fpo-qv .po-qv-kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
#fpo-qv .po-qv-kv > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
#fpo-qv .po-qv-kv .num { text-align: left; }
#fpo-qv .po-qv-kv .due { max-width: 220px; }
#fpo-qv .fpoqv-wait { cursor: pointer; }
#fpo-qv .fpoqv-h { font-weight: 800; font-size: 13.5px; }
#fpo-qv .fpoqv-last { display: flex; flex-direction: column; gap: 8px; }
#fpo-qv .po-qv-thread { display: flex; flex-direction: column; gap: 12px; }
#fpo-qv .fpo-msg .meta { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
#fpo-qv .bubble { max-width: 86%; white-space: normal; overflow-wrap: anywhere; }
#fpo-qv .bubble.me a { color: #fff; }
/* Line items */
#fpo-qv .rdpo-lt-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; max-width: 100%; }
#fpo-qv .rdpo-lt { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
#fpo-qv .rdpo-lt th { background: var(--sunk); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; font-weight: 800; color: var(--muted); padding: 8px 10px; white-space: nowrap; border-bottom: 1px solid var(--line); }
#fpo-qv .rdpo-lt td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
#fpo-qv .rdpo-lt tbody tr:last-child td { border-bottom: 0; }
#fpo-qv .rdpo-lt .sty { text-align: left; min-width: 0; }
#fpo-qv .rdpo-lt td.sty .c { font-weight: 800; font-size: 12.5px; overflow-wrap: anywhere; }
#fpo-qv .rdpo-lt td.sty .d { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
#fpo-qv .rdpo-lt .num { text-align: right; white-space: nowrap; }
#fpo-qv .rdpo-lt td.t { font-weight: 700; }
#fpo-qv .rdpo-lt tfoot td { background: var(--sunk); font-weight: 800; border-top: 1px solid var(--line); border-bottom: 0; }
#fpo-qv .fpoqv-szs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
#fpo-qv .fpoqv-sz { height: 22px; font-size: 11.5px; gap: 4px; }
#fpo-qv .fpoqv-sz b { font-weight: 800; color: var(--ink); }
/* Files */
#fpo-qv .rdpo-ftiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
#fpo-qv .rdpo-ftile { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); text-decoration: none; transition: border-color .12s, box-shadow .12s; }
#fpo-qv .rdpo-ftile:hover { border-color: var(--accent); box-shadow: 0 6px 18px -10px rgba(27,32,82,.35); }
#fpo-qv .rdpo-ftile .th { display: flex; align-items: center; justify-content: center; aspect-ratio: 4/3; border-radius: 8px; background: var(--sunk); overflow: hidden; margin-bottom: 4px; }
#fpo-qv .rdpo-ftile .th img { width: 100%; height: 100%; object-fit: contain; display: block; }
#fpo-qv .rdpo-ftile .th.doc .x { font-size: 13px; font-weight: 800; letter-spacing: .05em; color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; }
#fpo-qv .rdpo-ftile .n { font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#fpo-qv .rdpo-ftile .m { font-size: 11.5px; color: var(--muted); font-weight: 600; }
@media (max-width: 760px) {
    #fpo-qv.po-qv { top: 0; right: 0; bottom: 0; width: var(--rd-vw, 100vw); border-radius: 0; }
    #fpo-qv .po-qv-h { flex-wrap: wrap; }
    #fpo-qv .po-qv-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #fpo-qv .rdpo-lt td.sty .d { max-width: 160px; }
}

/* ── PO 4: what the merchant's strip takes from oms-rd-admin.css ─────── */
#po-modal .rd .pc .omsc-set, #po-modal .pc .omsc-set { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
#po-modal .pc .ow-pc-empty { font-size: 12.5px; color: var(--muted); }
#po-modal .pc .rowkv span:last-child { min-width: 0; overflow-wrap: anywhere; }
#po-modal .pc.ow-pc-spec .btn { margin-top: 0; }
#po-modal .pc.ow-pc-det .btn { align-self: flex-start; }

/* ── PROD 2: buy-price tier cards ─────────────────────────────────────── */
#rdf-prod-ws .rdf-currow { flex-wrap: wrap; align-items: center; row-gap: 6px; }
#rdf-prod-ws .rdf-meta-sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 4px; }
#rdf-prod-ws .rdf-tiers {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 176px)); gap: 10px;
    justify-content: start; max-width: 760px;
}
#rdf-prod-ws .rdf-tier {
    display: flex; flex-direction: column; gap: 2px; min-width: 0;
    padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
#rdf-prod-ws .rdf-tier.best { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: #FAFBFF; }
#rdf-prod-ws .rdf-tier.empty { background: var(--sunk); }
#rdf-prod-ws .rdf-tier-h { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 800; min-height: 18px; }
#rdf-prod-ws .rdf-tier-best { font-size: 10px; letter-spacing: .02em; text-transform: none; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
#rdf-prod-ws .rdf-tier-q { font-size: 13.5px; font-weight: 700; color: var(--ink-2); margin-top: 4px; }
#rdf-prod-ws .rdf-tier-p { margin-top: 6px; font-variant-numeric: tabular-nums; }
#rdf-prod-ws .rdf-tier-p b { font-size: 22px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
#rdf-prod-ws .rdf-tier-p span { font-size: 12px; font-weight: 700; color: var(--muted); }
#rdf-prod-ws .rdf-tier-u { font-size: 11.5px; color: var(--muted); font-weight: 600; }
@media (max-width: 600px) {
    #rdf-prod-ws .rdf-tiers { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; }
}

/* ── CUST 2: the sub groups pop-up ────────────────────────────────────── */
.rdfc-sg-ov .rdfc-sg .rdfp-mb { gap: 10px; max-height: calc(var(--rd-vh, 100vh) * .62); overflow: hidden; }
.rdfc-sg-ov .rdfc-sg-hint { font-size: 12.5px; flex: none; }
.rdfc-sg-ov .rdfc-sg-q { height: 38px; min-height: 38px; width: 100%; flex: none; box-sizing: border-box; }
.rdfc-sg-ov .rdfc-sg-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px 2px; }
.rdfc-sg-ov .rdfc-sg-row {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; text-align: left;
    border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; color: var(--ink); cursor: pointer;
    transition: border-color .12s, background .12s;
}
.rdfc-sg-ov .rdfc-sg-row:hover, .rdfc-sg-ov .rdfc-sg-row:focus-visible { border-color: var(--accent); background: #FAFBFF; outline: none; }
.rdfc-sg-ov .rdfc-sg-row b { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; overflow-wrap: anywhere; }
.rdfc-sg-ov .rdfc-sg-row .muted { font-size: 12px; font-weight: 600; white-space: nowrap; }
.rdfc-sg-ov .rdfc-sg-row svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.rdfc-sg-ov .rdfc-sg-none, .rdfc-sg-ov .rdfc-sg-empty { font-size: 12.5px; padding: 6px 2px; }
#rdfc-root .rdfc-sg-btn { white-space: nowrap; }
