/* THE REVIEW SHEET (assets/review-sheet.js), shared by every reviewed form. rs- prefixed so no page collides.
   Josh, 2026-10-26 "Two columns, no left menu": at 1024px and wider the details strip runs across the top and the
   sheet splits into the tabs (left) and Review Decision (right). Narrower, it stacks, and the decision buttons sit
   in a strip that slides up at the bottom of the screen, the way the form's own action strip does. */
.rs-backdrop { position:fixed; inset:0; z-index:1000; background:rgba(15,23,42,0.55); display:flex;
  align-items:stretch; justify-content:center; }
.rs-backdrop[hidden] { display:none; }
.rs-sheet { background:var(--card,#fff); color:var(--text,#1f2937); width:100%; max-width:1280px; display:flex;
  flex-direction:column; overflow:hidden; }
.rs-strip { padding:0.85rem 1rem 0.6rem; border-bottom:2px solid var(--border,#e5e9ee); }
.rs-strip-top { display:flex; align-items:center; gap:0.6rem; }
.rs-title { margin:0; font-size:1.05rem; font-weight:700; flex:1 1 auto; min-width:0; }
.rs-pill { font-size:0.75rem; font-weight:700; padding:3px 10px; border-radius:999px; white-space:nowrap;
  background:#eef1f5; color:#4b5563; }
.rs-pill.approved { background:#d9f5e6; color:#0b5d33; }
.rs-pill.failed { background:#fde2e2; color:#8a1c1c; }
.rs-pill.revision { background:#ffe3c4; color:#7a3d00; }
.rs-close { font:inherit; font-weight:600; border:1px solid var(--border,#e5e9ee); background:var(--card,#fff);
  color:inherit; border-radius:8px; padding:0.4rem 0.8rem; cursor:pointer; }
.rs-details { display:flex; flex-wrap:wrap; gap:0.3rem 1.2rem; margin:0.5rem 0 0; font-size:0.85rem; }
.rs-kv { display:flex; gap:0.35rem; }
.rs-kv dt { color:var(--text-muted,#6b7280); }
.rs-kv dd { margin:0; font-weight:600; }
.rs-cols { flex:1 1 auto; min-height:0; overflow:auto; -webkit-overflow-scrolling:touch; }
.rs-main { padding:0 1rem 1rem; }
.rs-tabs { display:flex; gap:0.25rem; overflow-x:auto; border-bottom:1px solid var(--border,#e5e9ee);
  position:sticky; top:0; background:var(--card,#fff); z-index:1; }
.rs-tab { font:inherit; font-size:0.88rem; font-weight:600; border:0; background:none; color:var(--text-muted,#6b7280);
  padding:0.65rem 0.75rem; border-bottom:3px solid transparent; white-space:nowrap; cursor:pointer; }
.rs-tab.is-active { color:var(--brand-dark,#1e3a5f); border-bottom-color:var(--brand,#2c5282); }
.rs-tab:focus-visible { outline:2px solid var(--brand-dark,#1e3a5f); outline-offset:-2px; }
.rs-panel { padding-top:0.75rem; }
.rs-empty { color:var(--text-muted,#6b7280); }
.rs-side { padding:0 1rem 1rem; }
.rs-decision-title { margin:0 0 0.5rem; font-size:0.95rem; }
.rs-buttons { display:flex; gap:0.5rem; }
.rs-btn { flex:1 1 0; font:inherit; font-weight:700; border-radius:10px; padding:0.7rem 0.5rem; cursor:pointer;
  border:1px solid transparent; color:#fff; min-height:44px; }
.rs-btn:disabled { opacity:0.55; cursor:default; }
.rs-btn-approved { background:#0f9d58; }
.rs-btn-needs-revision { background:#d97706; }
.rs-btn-failed { background:#dc2626; }
.rs-note-label { display:block; margin-top:0.7rem; font-size:0.85rem; font-weight:600; }
.rs-note { width:100%; box-sizing:border-box; font:inherit; margin-top:0.3rem; padding:0.5rem 0.6rem;
  border:1px solid var(--border,#e5e9ee); border-radius:8px; background:var(--card,#fff); color:inherit; }
.rs-error { color:#b91c1c; font-size:0.85rem; margin:0.4rem 0 0; }

/* Phone and tablet: one column. The Review Decision block is a strip pinned to the bottom of the sheet that
   slides up when the sheet opens, like the form strip. */
@media (max-width: 1023.98px) {
  .rs-sheet { max-width:none; }
  /* A flex column, the tabs growing to fill it, so on a short record the strip still sits at the bottom of the
     screen rather than straight under the content; on a long one it sticks there while the record scrolls. */
  .rs-cols { display:flex; flex-direction:column; }
  .rs-main { flex:1 0 auto; }
  /* The STICKY element is .rs-side, the child of the scrolling .rs-cols: a sticky box can only stay put inside
     its own parent, so on a long record a sticky .rs-decision (a child of .rs-side) scrolled away with it. */
  .rs-has-decision .rs-side { position:sticky; bottom:0; z-index:2; background:var(--card,#fff); padding:0;
    border-top:2px solid var(--border,#e5e9ee); box-shadow:0 -6px 16px rgba(15,23,42,0.12); }
  .rs-decision { padding:0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
    animation:rs-slide-up 0.22s ease-out; }
}
@keyframes rs-slide-up { from { transform:translateY(100%); } to { transform:translateY(0); } }
@media (prefers-reduced-motion: reduce) { .rs-decision { animation:none; } }

/* Computer: two columns, no left menu. */
@media (min-width: 1024px) {
  .rs-backdrop { align-items:center; padding:2rem; }
  .rs-sheet { border-radius:14px; max-height:calc(100vh - 4rem); }
  .rs-cols { display:grid; grid-template-columns:minmax(0, 1fr) 340px; }
  .rs-side { border-left:2px solid var(--border,#e5e9ee); padding-top:0.9rem; position:sticky; top:0; align-self:start; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rs-pill { background:#2a313b; color:#cbd5e1; }
  :root:not([data-theme="light"]) .rs-pill.approved { background:#0f3a25; color:#a8ecc8; }
  :root:not([data-theme="light"]) .rs-pill.failed { background:#4a1717; color:#ffb4b4; }
  :root:not([data-theme="light"]) .rs-pill.revision { background:#4f2a07; color:#ffc98f; }
}
:root[data-theme="dark"] .rs-pill { background:#2a313b; color:#cbd5e1; }
:root[data-theme="dark"] .rs-pill.approved { background:#0f3a25; color:#a8ecc8; }
:root[data-theme="dark"] .rs-pill.failed { background:#4a1717; color:#ffb4b4; }
:root[data-theme="dark"] .rs-pill.revision { background:#4f2a07; color:#ffc98f; }

/* CLEAR FLAG (photo-stamp-never-silently-skipped step 3): the reason line under a flagged photo and, for a reviewer, the control. */
.rs-flag { margin:0.35rem 0 0.75rem; padding:0.5rem 0.65rem; border:2px solid #b91c1c; border-radius:6px; font-size:0.85rem; }
.rs-flag.is-cleared { border-color:#6b7280; }
.rs-flag-line { margin:0; font-weight:600; color:#b91c1c; }
.rs-flag.is-cleared .rs-flag-line { color:inherit; }
.rs-flag-who { margin:0.2rem 0 0; }
.rs-flag-clear { margin-top:0.5rem; }
.rs-flag-clear[hidden] { display:none; }
