/* OMS redesign — factory portal Resources, Settings, Team and Graveyard.
 * Rendered / re-laid out by /js/oms-rdf-pages2.js:
 *   #rdfp-res  inside #page-resources     #rdfp-team inside #page-team
 *   #rdfp-gy   inside #page-graveyard     #page-settings .settings-wrap.rdfp-set
 *   #rdfp-fab-add, #rdfp-invite, #rdfp-dyn — pop-ups appended to <body>
 * All of them carry .rd, so oms-rd.css components apply. Everything is
 * id-scoped so it beats the page's inline <style> and oms-mobile.css (which
 * loads after this file). No remote assets.
 */

/* The old markup stays in the DOM (it is the fallback if the module is
   missing) and is hidden once the module has taken the page over. */
#page-resources.rdfp-on > .page-header,
#page-resources.rdfp-on > .card,
#page-team.rdfp-on > .page-header,
#page-team.rdfp-on > .card,
#page-graveyard.rdfp-on > .page-header,
#page-graveyard.rdfp-on > .table-container,
#page-settings.rdfp-on > .page-header { display: none; }

/* ── Shared list-page layout (the rdfc pattern) ── */
#rdfp-res, #rdfp-team, #rdfp-gy { display: flex; flex-direction: column; gap: 16px; font-size: 14px; color: var(--ink); min-width: 0; }
.rdfp .ph { align-items: flex-end; }
.rdfp .ph h1 { color: var(--ink); }
.rdfp .ph p { margin-top: 4px; max-width: 760px; }
.rdfp .btn, .rdfp .iconbtn { cursor: pointer; }
.rdfp .btn:disabled { opacity: .5; cursor: default; }
.rdfp .muted { color: var(--muted); }
.rdfp .btn.bad { background: #fff; }

.rdfp .rdfp-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.rdfp .rdfp-sum-k {
    appearance: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; min-width: 0;
    display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface);
}
.rdfp .rdfp-sum-k:hover { border-color: var(--line-2); box-shadow: 0 1px 2px rgba(20,24,60,.06); }
.rdfp .rdfp-sum-k:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rdfp .rdfp-sum-k.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.rdfp .rdfp-sum-k .ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.rdfp .rdfp-sum-k .ico svg { width: 18px; height: 18px; }
.rdfp .rdfp-sum-tx { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.rdfp .rdfp-sum-tx b { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rdfp .rdfp-sum-tx span { font-size: 12.5px; font-weight: 700; color: var(--muted); line-height: 1.3; }
.rdfp .rdfp-sum-tx i { font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--muted); opacity: .85; line-height: 1.3; margin-top: 2px; }

.rdfp .rdfp-segrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.rdfp .seg.rdfp-seg { flex-wrap: wrap; max-width: 100%; }
.rdfp .seg.rdfp-seg a { cursor: pointer; user-select: none; white-space: nowrap; color: var(--ink-2); }
.rdfp .seg.rdfp-seg a.on { color: var(--ink); }
.rdfp .seg.rdfp-seg a .c { font-weight: 700; }

.rdfp .rdfp-listcard { overflow: hidden; min-width: 0; }
.rdfp .rdfp-listcard .ch h3 { color: var(--ink); }
.rdfp .rdfp-chsub { font-size: 12.5px; margin-top: 2px; }
.rdfp .rdfp-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.rdfp .rdfp-toolbar .input { height: 36px; font-size: 13.5px; }
.rdfp .rdfp-toolbar .rdfp-search { width: auto; min-width: 220px; flex: 1 1 220px; max-width: 380px; }
.rdfp .rdfp-toolbar .rdfp-select { width: auto; min-width: 170px; flex: 0 0 auto; padding: 0 10px; font-size: 13px; }
.rdfp .rdfp-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rdfp .tbl.rdfp-tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rdfp .tbl.rdfp-tbl th {
    background: var(--sunk); color: var(--muted); padding: 10px 14px; font-size: 11px; letter-spacing: .07em;
    text-transform: uppercase; font-weight: 700; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left;
}
.rdfp .tbl.rdfp-tbl th.num, .rdfp .tbl.rdfp-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rdfp .tbl.rdfp-tbl th.rdfp-c, .rdfp .tbl.rdfp-tbl td.rdfp-c { text-align: center; }
.rdfp .tbl.rdfp-tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13.5px; white-space: nowrap; color: var(--ink); }
.rdfp .tbl.rdfp-tbl tr:last-child td { border-bottom: 0; }
.rdfp .tbl.rdfp-tbl tr:hover { background: none; }
.rdfp .tbl.rdfp-tbl tr.rdfp-row { cursor: pointer; }
.rdfp .tbl.rdfp-tbl tr.rdfp-row:hover td { background: rgba(61,78,232,.035); }
.rdfp .tbl.rdfp-tbl td.rdfp-wrap { white-space: normal; min-width: 120px; max-width: 280px; line-height: 1.4; }
.rdfp .tbl.rdfp-tbl td.rdfp-notes { color: var(--ink-2); white-space: pre-wrap; }
.rdfp .tbl.rdfp-tbl td.rdfp-empty { text-align: center; color: var(--muted); padding: 34px 16px; white-space: normal; }
.rdfp .tbl.rdfp-tbl td.rdfp-bad { color: var(--bad); font-weight: 600; }
.rdfp .tbl.rdfp-tbl .pill, .rdfp .tbl.rdfp-tbl .chip { height: 22px; font-size: 11.5px; }
.rdfp .rdfp-sub { font-size: 12px; margin-top: 2px; font-weight: 600; }
.rdfp .rdfp-small { font-size: 12px; }
.rdfp .rdfp-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; }

/* status pills not driven by the status registry */
.rdfp .pill.rdfp-ok { background: var(--ok-soft); color: var(--ok); }
.rdfp .pill.rdfp-warn { background: var(--warn-soft); color: var(--warn); }
.rdfp .pill.rdfp-off { background: #EEF0F5; color: var(--muted); }

/* ── Resources: fabric table ── */
#rdfp-res .rdfp-code { font-size: 13px; letter-spacing: .01em; }
#rdfp-res td.rdfp-img-td { width: 64px; padding-top: 7px; padding-bottom: 7px; }
.rdfp .rdfp-fimg { display: block; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: #F1F2F7; }
.rdfp .rdfp-fup {
    display: grid; place-items: center; border: 1.5px dashed var(--line-2); border-radius: 8px; cursor: pointer;
    color: var(--muted); background: var(--sunk); position: relative;
}
.rdfp .rdfp-fup:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.rdfp .rdfp-fup svg { width: 16px; height: 16px; }
.rdfp .rdfp-fup input, .rdfp .rdfp-upbtn input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.rdfp .rdfp-busy { opacity: .5; pointer-events: none; }
.rdfp td.rdfp-act { width: 52px; text-align: right; }
.rdfp .iconbtn.rdfp-ib { width: 30px; height: 30px; border-radius: 8px; }
.rdfp .iconbtn.rdfp-ib svg { width: 14px; height: 14px; }
.rdfp .iconbtn.rdfp-ib:hover { border-color: var(--accent); color: var(--accent); }

/* ── Team ── */
.rdfp .rdfp-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rdfp td.rdfp-person-td { min-width: 220px; white-space: normal; }
.rdfp .rdfp-nm { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.rdfp .rdfp-nm b { font-weight: 800; color: var(--ink); }
.rdfp .rdfp-nm .muted { font-size: 12.5px; overflow-wrap: anywhere; }
.rdfp .rdfp-av { display: inline-grid; place-items: center; flex: none; border-radius: 50%; color: #fff; font-weight: 800; letter-spacing: .02em; line-height: 1; }
.rdfp .chip.rdfp-you { height: 18px; padding: 0 6px; font-size: 10.5px; vertical-align: 1px; }
.rdfp td.rdfp-acts-td { text-align: right; }
.rdfp .rdfp-acts { display: inline-flex; gap: 6px; justify-content: flex-end; }
.rdfp .rdfp-acts .btn svg, .rdfp .rdfp-mf .btn svg { width: 14px; height: 14px; }
.rdfp input.cbx { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.rdfp input.cbx:disabled { cursor: not-allowed; }

/* ── Graveyard ── */
#rdfp-gy .rdfp-gyrow td { color: var(--ink-2); }
#rdfp-gy .rdfp-gyrow td b { color: var(--ink); }

/* ── Settings: the old cards as admin-Settings blocks (title above card) ── */
#page-settings .settings-wrap.rdfp-set {
    display: flex !important;            /* beats the inline grid on .settings-wrap */
    flex-direction: column; align-items: stretch !important; gap: 22px; max-width: 980px; font-size: 14px; color: var(--ink);
}
#page-settings .rdfp-set .set-head { padding-bottom: 2px; }
#page-settings .rdfp-set .set-title h1 { color: var(--ink); }
#page-settings .rdfp-set .card.rdfp-srow {
    background: none; border: 0; border-radius: 0; box-shadow: none; margin: 0;
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 22px 0 0; border-top: 1px solid var(--line);
}
#page-settings .rdfp-set .card.rdfp-srow[style*="display: none"],
#page-settings .rdfp-set .card.rdfp-srow[style*="display:none"] { display: none; }
#page-settings .rdfp-set .rdfp-srow > .card-header,
#page-settings .rdfp-set .rdfp-scard > p:first-child { display: none; }
#page-settings .rdfp-srow-h h3 { margin: 0; font-size: 14.5px; font-weight: 800; color: var(--ink); }
#page-settings .rdfp-srow-h p { margin: 5px 0 0; color: var(--muted); font-size: 12.8px; line-height: 1.5; max-width: 760px; }
#page-settings .rdfp-srow-h p.rdfp-ro { color: var(--warn); font-weight: 700; }
#page-settings .rdfp-srow-h p[hidden] { display: none; }
#page-settings .rdfp-set .card-body.rdfp-scard {
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px;
    display: flex; flex-direction: column; gap: 14px; align-items: flex-start;
}
#page-settings .rdfp-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; width: 100%; }
#page-settings .rdfp-fields .rdfp-span { grid-column: 1 / -1; }
#page-settings .rdfp-set .form-group { display: flex; flex-direction: column; gap: 6px; margin: 0; min-width: 0; }
#page-settings .rdfp-set .form-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin: 0; display: block; }
#page-settings .rdfp-set .form-input {
    width: 100%; height: 38px; border: 1px solid var(--line-2); border-radius: 9px; padding: 0 12px; font-family: inherit;
    font-size: 13.5px; font-weight: 500; color: var(--ink); background: #fff; box-shadow: none; margin: 0; min-width: 0;
}
#page-settings .rdfp-set textarea.form-input { height: auto; padding: 10px 12px; line-height: 1.45; resize: vertical; }
#page-settings .rdfp-set .form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#page-settings .rdfp-set .form-input:disabled { background: var(--sunk); color: var(--ink-2); cursor: not-allowed; }
#page-settings .rdfp-saverow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#page-settings .rdfp-saverow > span { margin-left: 0 !important; font-size: 12.5px; font-weight: 600; } /* beats the inline margin */

/* ── Pop-ups ── */
body.rdfp-modal-open { overflow: hidden; }
.rdfp-ov.rd {
    position: fixed; inset: 0; z-index: 9000; background: rgba(20,24,45,.45);
    display: flex; justify-content: center; align-items: flex-start; padding: calc(var(--rd-vh, 100vh) * .08) 16px 16px; overflow-y: auto;
}
.rdfp-ov.rd[hidden] { display: none; }
.rdfp-ov .rdfp-modal {
    width: 600px; max-width: 100%; background: #fff; border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(20,24,45,.5);
    display: flex; flex-direction: column; font-size: 14px; color: var(--ink);
}
.rdfp-ov .rdfp-modal.rdfp-modal-sm { width: 500px; }
.rdfp-ov .rdfp-mh { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.rdfp-ov .rdfp-mh h3 { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); overflow-wrap: anywhere; }
.rdfp-ov .rdfp-x { width: 32px; height: 32px; cursor: pointer; flex: none; }
.rdfp-ov .rdfp-x svg { width: 16px; height: 16px; }
.rdfp-ov .rdfp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rdfp-ov .rdfp-mb { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.rdfp-ov .rdfp-mf { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--sunk); border-radius: 0 0 16px 16px; }
.rdfp-ov .btn { cursor: pointer; }
.rdfp-ov .btn:disabled { opacity: .5; cursor: default; }
.rdfp-ov .btn.bad { background: #fff; }
.rdfp-ov .rdfp-note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.rdfp-ov .rdfp-g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rdfp-ov .rdfp-g2 .rdfp-span { grid-column: 1 / -1; }
.rdfp-ov .rdfp-f { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.rdfp-ov .rdfp-f .lbl { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.rdfp-ov .rdfp-help { font-size: 12px; }
/* the page's own inputs, moved in, drawn as .rd .input */
.rdfp-ov .rdfp-f .form-input, .rdfp-ov .rdfp-f .input {
    width: 100%; height: 38px; border: 1px solid var(--line-2); border-radius: 9px; padding: 0 12px; margin: 0;
    font-family: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink); background: #fff; box-shadow: none; min-width: 0;
}
.rdfp-ov .rdfp-f > .form-input { flex: none !important; min-height: 38px; }   /* #new-team-* carry an inline flex:1/2 */
.rdfp-ov .rdfp-f textarea.input { height: auto; padding: 10px 12px; line-height: 1.45; resize: vertical; }
.rdfp-ov .rdfp-f .form-input:focus, .rdfp-ov .rdfp-f .input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rdfp-ov #fs-fab-uses { margin-top: 0 !important; }   /* beats its inline margin-top */
.rdfp-ov .rdfp-status { min-height: 0; }
.rdfp-ov .rdfp-status > span { margin-left: 0 !important; font-size: 13px; font-weight: 600; }
.rdfp-ov .rdfp-status > span:empty { display: none; }

/* edit-fabric image block */
.rdfp-ov .rdfp-fabimg { display: flex; gap: 14px; align-items: center; }
.rdfp-ov .rdfp-fabimg-box { width: 96px; height: 96px; flex: none; border: 1px solid var(--line); border-radius: 10px; background: #F1F2F7; display: grid; place-items: center; overflow: hidden; text-align: center; font-size: 11.5px; padding: 4px; }
.rdfp-ov .rdfp-fabimg-box img { width: 100%; height: 100%; object-fit: contain; display: block; }
.rdfp-ov .rdfp-fabimg-tx { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; font-size: 12.5px; line-height: 1.45; }
.rdfp-ov .rdfp-fabimg-tx .lbl { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.rdfp-ov .rdfp-upbtn { position: relative; cursor: pointer; }

/* team-member record */
.rdfp-ov .rdfp-person-lg .rdfp-nm b { font-size: 16px; }
.rdfp-ov .rdfp-kv { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; }
.rdfp-ov .rdfp-kv > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: center; font-size: 13.5px; }
.rdfp-ov .rdfp-kv > div:last-child { border-bottom: 0; }
.rdfp-ov .rdfp-kv > div > span:first-child { font-size: 12.5px; font-weight: 700; }
.rdfp-ov .rdfp-chk { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); line-height: 1.4; cursor: pointer; }
.rdfp-ov .rdfp-chk input { margin-top: 1px; flex: none; }
.rdfp-ov .rdfp-mf .rdfp-acts { display: contents; }

/* toast */
.rdfp-toast.rd {
    position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 9100; opacity: 0; pointer-events: none;
    background: var(--nav); color: #fff; font-size: 13.5px; font-weight: 700; padding: 11px 18px; border-radius: 10px;
    box-shadow: 0 12px 30px -10px rgba(20,24,45,.5); transition: opacity .18s, transform .18s; max-width: calc(var(--rd-vw, 100vw) - 32px);
}
.rdfp-toast.rd.show { opacity: 1; transform: translate(-50%, 0); }
.rdfp-toast.rd.bad { background: var(--bad); }

/* ── Responsive ── */
@media (max-width: 1100px) {
    .rdfp .rdfp-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .rdfp .ph { flex-direction: column; align-items: flex-start; }
    .rdfp .rdfp-toolbar .rdfp-search { max-width: none; min-width: 0; }
    .rdfp .rdfp-toolbar .rdfp-select { flex: 1 1 160px; }
    #page-settings .rdfp-fields { grid-template-columns: minmax(0, 1fr); }
    .rdfp-ov.rd { padding: 12px; }
    .rdfp-ov .rdfp-g2 { grid-template-columns: minmax(0, 1fr); }
    .rdfp-ov .rdfp-kv > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
@media (max-width: 480px) {
    .rdfp .rdfp-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .rdfp .rdfp-sum-k { padding: 12px; }
    .rdfp .rdfp-sum-k .ico { display: none; }
    .rdfp .rdfp-sum-tx b { font-size: 21px; }
    .rdfp .rdfp-foot > span:last-child { display: none; }
}
