/* PUIG skin, admin screens (visual only; loaded after puig.css): credits, audit, management tables,
   retouch queue and detail, pair editor. r2-admin.js sets body.r2-adm and tags date (r2-date) and
   number (r2-num) columns. */

/* --- Tables: caption-tone headers, 1px rules, unbroken dates, aligned numbers --- */
html body.r2-adm main th { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--ds-fg-subtle); text-transform: none;
  letter-spacing: 0; padding: 10px 20px 10px 0; border-bottom: 1px solid var(--ds-border); white-space: nowrap; vertical-align: bottom; }
html body.r2-adm main td { padding: 12px 20px 12px 0; border-bottom: 1px solid var(--ds-border-subtler); line-height: 1.4; }
html body.r2-adm main th:last-child, html body.r2-adm main td:last-child { padding-right: 0; }
html body.r2-adm main tr:last-child > td { border-bottom: 0; }
html body.r2-adm main .r2-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
html body.r2-adm main td.r2-date { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ds-fg-subtle); font-size: 12.5px; }
html body.r2-adm main td.r2-nowrap { white-space: nowrap; }
html body.r2-adm main .r2-tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
html body.r2-adm main .r2-tscroll > table { min-width: 100%; }
html body.r2-adm main .r2-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
html body.r2-adm main .r2-empty-role { display: none; }
html body .r2-showall { margin-top: 14px; }
html body tr.r2-hide, html body.r2-adm main table.r2-stack tr.r2-hide { display: none; }

/* Audit: full-width table, user on one line */
html body.r2-adm main td.r2-who { white-space: nowrap; }
html body.r2-adm main td.r2-who .sub { margin-left: 4px; }

/* --- Credits: pool and balances on top, forms below, full-width movements --- */
@media (min-width: 901px) {
  html body .credits-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; row-gap: 16px; align-items: start; }
  html body .credits-grid > div { display: contents; }
  html body .credits-grid > div > .card { margin: 0; min-width: 0; }
  html body .credits-grid > div:first-child > .card:first-child { grid-column: 1; grid-row: 1; }
  html body .credits-grid > div:last-child > .card:first-child { grid-column: 2; grid-row: 1; }
  html body .credits-grid > div:last-child > .card:last-child { grid-column: 1 / -1; grid-row: auto; order: 9; }
  html body .credits-grid td.sub, html body .credits-grid td:first-child { white-space: nowrap; }
}
html body .credits-grid .r2-hist td { vertical-align: top; }
html body .credits-grid .r2-hist td.r2-reason { min-width: 280px; width: 100%; }

/* --- Narrow screens: audit and movements as a list (one row = one block) --- */
@media (max-width: 640px) {
  html body.r2-adm main table.r2-stack, html body.r2-adm main table.r2-stack tbody,
  html body.r2-adm main table.r2-stack tr, html body.r2-adm main table.r2-stack td { display: block; width: auto; }
  html body.r2-adm main table.r2-stack tr:first-child:has(> th) { display: none; }
  html body.r2-adm main table.r2-stack tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 12px 0; border-bottom: 1px solid var(--ds-border-subtler); }
  html body.r2-adm main table.r2-stack td { flex: 1 1 100%; }
  html body.r2-adm main table.r2-stack td.r2-date, html body.r2-adm main table.r2-stack td.r2-who,
  html body.r2-adm main table.r2-stack td.r2-num, html body.r2-adm main table.r2-stack td.r2-nowrap { flex: 0 0 auto; }
  html body.r2-adm main table.r2-stack tr:hover td { background: transparent; }
  html body.r2-adm main table.r2-stack td { border: 0; padding: 2px 0; text-align: left; max-width: none !important; }
  html body.r2-adm main table.r2-stack td.r2-date { font-size: 12px; }
  html body.r2-adm main table.r2-stack td.r2-reason { min-width: 0; }
}

/* --- Retouch queue: unboxed figures, statuses without pills --- */
html body .rq-stats { gap: 28px; }
html body .rq-stats .rq-stat { background: transparent; border: 0; border-top: 1px solid var(--ds-border); border-radius: 0; box-shadow: none;
  padding: 10px 0 0; min-width: 120px; text-align: left; }
html body .rq-stats .rq-stat .n { font-size: 32px; line-height: 1.1; }
html body .rq-stats .rq-stat .l { color: var(--ds-fg-subtle); }
html body .rq-act .rq-done { background: transparent; border: 0; border-top: 1px solid var(--ds-border-subtler); border-radius: 0;
  padding: 12px 0 0; text-align: left; display: grid; gap: 4px; }
html body .rq-act .rq-done b { color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
html body .rq-act .rq-done b .ico { color: #2E9B61; }
html body .rq-wip.st-live { background: transparent; border: 0; padding: 0; display: inline-flex; align-items: center; gap: 8px; text-align: left; }
html body .rq-wip.st-live .orb { flex: none; display: block; }
html body .rq-th .chip .ico, html body .rr-head .chip .ico { width: 12px; height: 12px; vertical-align: -2px; }

/* Retouch detail: upload checks as check/dot + text */
html body .rr-checks .badge { background: transparent; border: 0; padding: 0; border-radius: 0; color: var(--ink); font-weight: 400;
  font-size: 13px; display: inline-flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; }
html body .rr-checks .badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none; background: #F1C488; position: static; }
html body .rr-checks .badge.b-ok::before { content: none; }
html body .rr-checks .badge.b-ok .ico { color: #2E9B61; width: 14px; height: 14px; }
html body .rr-checks .badge.b-review::before { background: transparent; border: 1px solid #000; box-sizing: border-box; }
html body .rr-checks .badge.b-ko_manual::before { background: var(--err, #910D19); }
html body .rr-checks { gap: 8px 18px; }
html body .rr-empty { background: transparent; border: 0; box-shadow: none; }
html body .rr-empty .orb { margin-bottom: 4px; }

/* --- Pair editor --- */
html body .pe-ud button { width: 28px; height: 20px; display: inline-flex; align-items: center; justify-content: center; color: var(--ds-fg-subtle); }
html body .pe-ud button:hover { color: var(--ink); }
html body .pe-ud .ico { width: 14px; height: 14px; vertical-align: 0; }
html body .pe-row, html body .pe-row.rep { border: 1px solid var(--ds-border-subtler); }
html body .pe-row.rep { border-color: var(--ds-border-subtle); }
html body .pe-slot.rep, html body .pe-img.rep .fr { border-color: var(--ds-border-subtle); }
html body .pe-img .fr, html body .pe-slot { border-width: 1px; }
html body .pe-img.picked .fr { border-color: #000; }
html body .pe-img img, html body .pe-slot img { object-fit: contain; background: #EFEFEF; }
html body .pe-img .fr, html body .pe-slot { background: #EFEFEF; border-radius: 2px; }
html body .pe-img .tag, html body .pe-slot .tag { border-radius: 2px; }
html body .pe-msg, html body .pe-msg.warn { background: transparent; color: var(--ink); padding: 0; border-radius: 0; font-size: 13px;
  display: flex; align-items: center; gap: 8px; }
html body .pe-msg::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #F1C488; flex: none; }
html body .pe-msg.err::before { background: var(--err, #910D19); }
html body .pe-img .use, html body .pe-img .use.free, html body .pe-img .use.rep, html body .pe-img.pending .use { color: var(--ds-fg-subtle); }
html body #pe-approve-all:disabled { background: transparent; color: var(--ink); border: 1px solid var(--ink); opacity: .4; box-shadow: none; }
html body .pe-add { border: 1px solid var(--ink); border-radius: 4px; min-height: 40px; padding: 0 16px; display: inline-flex; align-items: center; gap: 6px; }
html body .pe-add:hover { background: var(--ds-hover); }
html body .pe-add .ico { width: 14px; height: 14px; vertical-align: 0; }
html body .pe-swap { border-color: var(--ds-border-subtle); }
html body .back-link .ico, html body a.btn .ico.r2-nav { width: 14px; height: 14px; vertical-align: -2px; }
