/* OMS redesign — factory portal extras.
 *
 * Loaded right after oms-rd.css on factory-new.html only. The component classes
 * (.btn, .card, .wtabs, .col-card, .pv-strip …) come from oms-rd.css and are all
 * scoped under .rd; this file adds what the factory screens need on top:
 *   1. Login (LoginFactory canvas)
 *   2. PO board (FactoryBoard canvas)
 *   3. PO workspace (FactoryPO / FactoryPOProducts canvases) — including turning
 *      #po-modal from a fixed overlay into an in-flow page
 *   4. Size-chart popup
 *   5. Legacy content rendered inside .rd (old .btn-* classes) and print
 * No remote assets. No !important.
 */

/* ---------- small .rd gaps ------------------------------------------------ */
.rd .col-b[hidden], .rd .menu[hidden], .rd .pv-strip[hidden] { display: none; }

/* ======================================================================
   1. LOGIN
   ====================================================================== */
#login-page.lp-rd {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 560px;
    align-items: stretch;
    justify-content: stretch;
    min-height: var(--rd-vh, 100vh);
    padding: 0;
    background: var(--surface);
    overflow: hidden;
}
#login-page.lp-rd::before, #login-page.lp-rd::after { display: none; }
#login-page .lpr-brandpane {
    background: var(--nav); color: #fff; padding: 56px;
    display: flex; flex-direction: column; justify-content: space-between;
    position: relative; overflow: hidden; min-height: var(--rd-vh, 100vh);
}
#login-page .lpr-lockup { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
#login-page .lpr-mark {
    width: 44px; height: 44px; border-radius: 12px; flex: none;
    background: linear-gradient(135deg, #6474FF, #3A3FD8); color: #fff;
    display: grid; place-items: center;
}
#login-page .lpr-mark svg { width: 22px; height: 22px; }
#login-page .lpr-name { font-weight: 800; font-size: 18px; line-height: 1.2; }
#login-page .lpr-name small { display: block; font-size: 12px; font-weight: 600; color: var(--nav-ink); }
#login-page .lpr-tiles {
    position: absolute; right: 56px; top: 120px; opacity: .9;
    display: grid; grid-template-columns: repeat(6, 72px); gap: 12px;
}
#login-page .lpr-tiles i { display: block; height: 72px; border-radius: 14px; background: #36415B; }
#login-page .lpr-tiles i:nth-child(6n+1), #login-page .lpr-tiles i:nth-child(6n) { background: #5B6984; }
#login-page .lpr-tiles i:nth-child(6n+3) { background: #9BA7BC; }
#login-page .lpr-copy { position: relative; z-index: 1; max-width: 520px; }
#login-page .lpr-copy h2 { margin: 0; font-size: 44px; line-height: 1.05; letter-spacing: -.03em; color: #fff; }
#login-page .lpr-copy h2 span { display: block; font-size: 24px; font-weight: 600; color: var(--nav-ink); margin-top: 10px; letter-spacing: -.01em; }
#login-page .lpr-copy p { margin: 16px 0 0; font-size: 16px; color: var(--nav-ink); line-height: 1.5; }

#login-page .lpr-formpane { padding: 0 72px; display: flex; flex-direction: column; min-height: var(--rd-vh, 100vh); background: var(--surface); }
#login-page .lpr-formbody { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
#login-page .lpr-badge { margin-bottom: 14px; }
#login-page .lpr-title { margin: 0; font-size: 28px; letter-spacing: -.02em; font-weight: 800; color: var(--ink); }
#login-page .lpr-title .muted { font-weight: 600; font-size: 20px; }
#login-page .lpr-sub { margin: 6px 0 0; font-size: 14px; }
#login-page .lp-error { margin-bottom: 0; }
#login-page .lp-field label { text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--ink-2); }
#login-page .lp-field input { border-width: 1px; border-color: var(--line-2); background: #fff; font-family: inherit; }
#login-page .lp-btn-signin { background: var(--accent); box-shadow: none; border-radius: 11px; height: 48px; font-weight: 700; font-family: inherit; }
#login-page .lp-btn-signin::before { display: none; }
#login-page .lpr-credit {
    padding: 22px 0 28px; border-top: 1px solid var(--line);
    display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted);
}
#login-page .lpr-credit img { height: 13px; width: auto; opacity: .6; display: block; }

@media (max-width: 1100px) {
    #login-page.lp-rd { grid-template-columns: minmax(0, 1fr) 480px; }
    #login-page .lpr-tiles { display: none; }
    #login-page .lpr-formpane { padding: 0 48px; }
}
@media (max-width: 900px) {
    #login-page.lp-rd { grid-template-columns: minmax(0, 1fr); }
    #login-page .lpr-brandpane { min-height: 0; padding: 28px 16px; gap: 20px; }
    #login-page .lpr-copy h2 { font-size: 28px; }
    #login-page .lpr-copy h2 span { font-size: 17px; }
    #login-page .lpr-copy p { font-size: 14px; }
    #login-page .lpr-formpane { min-height: 0; padding: 0 16px; }
    #login-page .lpr-formbody { padding: 28px 0; }
}

/* ======================================================================
   2. PO BOARD
   ====================================================================== */
.fpo-board-page { margin-bottom: 16px; display: flex; flex-direction: column; gap: 14px; }
.fpo-board-page .ph h1 { color: var(--ink); }
.fpo-board-page .fpo-h1-en { font-weight: 600; color: var(--muted); font-size: 18px; }
.fpo-board-page .seg a { cursor: pointer; color: var(--ink-2); }
.fpo-board-page .seg a.on { color: var(--ink); }
#page-purchase-orders .fpo-stats { margin-bottom: 14px; }
#page-purchase-orders .fpo-filterbar { margin-bottom: 14px; }

.fpo-board {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr);
    gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 8px;
}
.fpo-board .col { min-width: 0; }
.fpo-board .colh .sd { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.fpo-board .colh .en { font-weight: 600; color: var(--muted); }
.fpo-board .fpo-card { cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.fpo-board .fpo-card:hover { border-color: var(--line-2); box-shadow: 0 6px 18px -10px rgba(27,32,82,.35); }
.fpo-board .fpo-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* `is-urgent`, never bare `urgent`: oms-rd-pills.css styles every `.urgent` as a 22px
   pill, which crushed urgent Kanban cards into a thin strip (25-10-2026). */
.fpo-board .fpo-card.is-urgent { border-color: #F4C3CA; box-shadow: inset 3px 0 0 var(--bad); }
.fpo-board .fpo-card-num { font-size: 15px; font-weight: 800; }
.fpo-board .fpo-flags { display: flex; gap: 6px; flex-wrap: wrap; }
.fpo-board .fpo-empty { padding: 14px; font-size: 12.5px; color: var(--muted); border: 1.5px dashed var(--line-2); border-radius: 12px; text-align: center; }
.fpo-board .fpo-none { grid-column: 1 / -1; padding: 40px; text-align: center; color: var(--muted); }
.fpo-board .fpo-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }

/* ======================================================================
   3. PO WORKSPACE — #po-modal as a page
   ====================================================================== */
#po-modal.fpo-ws {
    position: static; width: auto; height: auto; background: none;
    z-index: auto; display: none; align-items: stretch; justify-content: flex-start;
}
#po-modal.fpo-ws.show { display: block; }
body.fpo-ws-open .main-content > .page-section.active { display: none; }

.fpo-ws-page { display: flex; flex-direction: column; gap: 16px; font-size: 14px; }
.fpo-ws-page .crumb a { cursor: pointer; }
.fpo-ws-page .fpo-head-row { justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.fpo-ws-page .fpo-head-row2 { margin-top: 12px; }
.fpo-ws-page .ws-head h1 { color: var(--ink); }
.fpo-ws-page .ws-head h1.sub { color: var(--muted); }
.fpo-ws-page .ws-head h1.sub:empty { display: none; }
.fpo-ws-page .fpo-navpos { font-size: 12.5px; font-weight: 700; min-width: 44px; text-align: center; }
.fpo-ws-page .iconbtn { cursor: pointer; font-size: 18px; line-height: 1; }
.fpo-ws-page .iconbtn:disabled { opacity: .4; cursor: default; }
.fpo-ws-page .fpo-chips { gap: 8px; flex-wrap: wrap; }
.fpo-ws-page .fpo-actions { position: relative; gap: 8px; }
.fpo-ws-page .fpo-actions .menu { top: 42px; max-height: calc(var(--rd-vh, 100vh) * .7); overflow-y: auto; }
.fpo-ws-page .menu button:disabled { color: var(--muted); cursor: default; background: none; }
.fpo-ws-page .wtab { cursor: pointer; }
.fpo-ws-page .save-dirty { font-size: 12.5px; font-weight: 700; color: var(--warn); }

.fpo-ws-page .fpo-cols { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.fpo-ws-page .fpo-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fpo-ws-page .col-card .col-h { font-size: 14px; }
.fpo-ws-page .d3 .input[type="date"] { font-family: inherit; }
.fpo-ws-page .d3 .etd-overdue { border-color: #F0BCC4; background: var(--bad-soft); color: var(--bad); }
.fpo-ws-page .d3 .etd-warning { border-color: #F2D08A; background: var(--warn-soft); }
.fpo-ws-page .fpo-addr { font-weight: 600; line-height: 1.55; margin-top: 4px; }
.fpo-ws-page .note-bad { background: var(--bad-soft); color: var(--bad); border-radius: 9px; padding: 10px 12px; font-size: 12.5px; font-weight: 600; line-height: 1.45; }
.fpo-ws-page .note-info { background: var(--accent-soft); color: #2A37B8; border-radius: 9px; padding: 10px 12px; font-size: 12.5px; font-weight: 600; line-height: 1.45; }
.fpo-ws-page .att .ico img { width: 30px; height: 30px; object-fit: cover; border-radius: 8px; display: block; }
.fpo-ws-page .tlb .big.late { color: var(--bad); }
.fpo-ws-page .tlb .fill.late { background: var(--bad); }

/* Messages fill the right column; the thread scrolls inside it instead of
   growing the column (absolute inset, so its content never sets the height). */
.fpo-ws-page .msgcol { min-height: 520px; }
.fpo-ws-page .fpo-thread-wrap { position: relative; flex: 1; min-height: 360px; }
.fpo-ws-page .fpo-thread-wrap > .thread { position: absolute; inset: 0; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
/* A run of messages from one person (oms-rdf-po.js sameRun) sits 4px apart under one header. */
.fpo-ws-page .fpo-msg.cont { margin-top: -8px; }
.fpo-ws-page .fpo-msg .meta a { color: inherit; }
.fpo-ws-page .bubble { max-width: 86%; white-space: normal; }
.fpo-ws-page .bubble.me a { color: #fff; }
.fpo-ws-page .fpo-composer { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }

/* Products tab */
.fpo-ws-page .pv .thumb { overflow: hidden; background: #fff; }
.fpo-ws-page .pv .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.fpo-ws-page .pv-head .fpo-fid { width: 220px; flex: none; }
.fpo-ws-page .pv-head .fpo-fid .muted { font-size: 11.5px; }
.fpo-ws-page .pv-head .fpo-fid .input.carried { border-color: #fcd34d; background: #fffbeb; }
.fpo-ws-page .pv-chips .po-artwork-slot a { margin-left: 0; }
.fpo-ws-page .pv-chips button.chip { cursor: pointer; font-family: inherit; }
.fpo-ws-page .qwrap { overflow-x: auto; }
.fpo-ws-page .qt { min-width: 520px; }
.fpo-ws-page .fpo-pp { align-items: flex-start; }
.fpo-ws-page .fpo-pp-l { font-weight: 800; font-size: 13px; padding-top: 14px; white-space: nowrap; }
.fpo-ws-page .fpo-pp .factory-prod-slot { flex: 1; min-width: 0; }
.fpo-ws-page button.pv-toggle { width: 100%; border: 0; border-top: 1px solid var(--line); font-family: inherit; cursor: pointer; text-align: left; }
.fpo-ws-page .pc .img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.fpo-ws-page .pc .img a { display: block; width: 100%; height: 100%; }
.fpo-ws-page .pc .img .none { font-size: 12px; color: var(--muted); font-weight: 600; }
.fpo-ws-page .pc.fpo-det { width: auto; min-width: 230px; }
.fpo-ws-page .pc .rowkv a { word-break: break-all; }
.fpo-ws-page .pc .btn { margin-top: auto; }
.fpo-ws-page .fpo-prod-top { justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.fpo-ws-page .fpo-prod-foot { justify-content: space-between; flex-wrap: wrap; gap: 10px; padding-top: 4px; }

/* All-stages popup: fixed to the viewport rather than the (long) page. */
#fpo-stages-holder .stg-ov { position: fixed; z-index: 1500; padding: 80px 16px 16px; overflow: auto; }
#fpo-stages-holder .stg-modal { max-width: 100%; }
#fpo-stages-holder .sm-grid { overflow-x: auto; }

@media (max-width: 1100px) {
    .fpo-ws-page .fpo-cols { grid-template-columns: minmax(0, 1fr); }
    .fpo-ws-page .d3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .fpo-ws-page .stages { flex-direction: column; }
    .fpo-ws-page .stg { margin-left: 0; margin-top: -1px; }
    .fpo-ws-page .stg:first-child { border-radius: 10px 10px 0 0; }
    .fpo-ws-page .stg:last-child { border-radius: 0 0 10px 10px; }
    .fpo-ws-page .s6 { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; }
    .fpo-ws-page .pv-head { flex-wrap: wrap; }
    .fpo-ws-page .pv-head .fpo-fid { width: 100%; }
    .fpo-ws-page .d3 { grid-template-columns: minmax(0, 1fr); }
    .fpo-board { grid-auto-columns: minmax(240px, calc(var(--rd-vw, 100vw) * .82)); }
}

/* ======================================================================
   4. SIZE-CHART POPUP
   ====================================================================== */
#fpo-sc-modal .fpo-sc {
    background: #fff; border-radius: 16px; width: 760px; max-width: calc(var(--rd-vw, 100vw) - 32px);
    max-height: calc(var(--rd-vh, 100vh) * .86); overflow: hidden; display: flex; flex-direction: column;
    box-shadow: 0 30px 80px -20px rgba(20,24,45,.45);
}
#fpo-sc-modal .fpo-sc .cb { overflow: auto; }
#fpo-sc-modal .iconbtn { cursor: pointer; font-size: 18px; }

/* ======================================================================
   5. Legacy content rendered inside .rd
   The old render functions (PPS banner, finished photos, panel-print slots,
   dialogs' triggers) still emit .btn .btn-primary / .btn-outline / .action-btn.
   `.rd .btn` would otherwise flatten their colours to white.
   ====================================================================== */
.rd .btn.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.rd .btn.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.rd .btn.btn-warning { background: var(--warn-soft); border-color: #F2D08A; color: var(--warn); }
.rd .btn.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }

@media print {
    body.fpo-ws-open .sidebar,
    body.fpo-ws-open #merchant-scope-bar,
    body.fpo-ws-open .fpo-actions,
    body.fpo-ws-open .fpo-ws-page .iconbtn,
    body.fpo-ws-open .fpo-composer,
    body.fpo-ws-open .wtabs,
    body.fpo-ws-open #fmsgTriggerWrap { display: none; }
    body.fpo-ws-open .main-content { margin-left: 0; padding: 0; }
    body.fpo-ws-open .fpo-thread-wrap > .thread { position: static; }
}

/* oms-rd.css's generic `.rd .dot` (the notification dot: position:absolute,
   top/right) also matches the stage-card step dots, which only reset its size.
   Pin them back into the row here, scoped to the factory workspace. */
.fpo-ws-page .stg .dot { position: static; }
