/* The Folded Review Screen, 2026-09-29. Phone first (390px). Inter, royal.
   Green is used for compliance only. */
#rs-panel {
  --rs-royal: #3B2E8C; --rs-royal-hover: #2F2470; --rs-deep: #241C57; --rs-on-dark: #B6ACE8;
  --rs-line: #E3E0F0; --rs-soft: #EEECF5; --rs-mute: #5E5A78; --rs-ink: #1B1740; --rs-bg: #F6F5FA;
  --rs-green: #1E7A46; --rs-amber: #C8811A; --rs-grey: #9A96B0;
  display: none; position: fixed; left: 0; top: 0; right: 0; height: 100vh; height: 100dvh;
  z-index: 1000; background: var(--rs-bg); color: var(--rs-ink);
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  font-family: inherit; -webkit-tap-highlight-color: transparent;
}
#rs-panel.rs-open { display: block; }
#rs-panel *, #rs-panel *::before, #rs-panel *::after { box-sizing: border-box; }
#rs-panel button { font-family: inherit; cursor: pointer; }
#rs-panel button:focus-visible, #rs-panel [contenteditable]:focus-visible { outline: 2px solid var(--rs-royal); outline-offset: 2px; }

/* 1. Top bar. Close on the left, always in the same place, large and obvious. Small arrows beside "N of M waiting". */
#rs-panel { --rs-top-h: 56px; --rs-red: #B3261E; }
.rs-top { position: sticky; top: 0; z-index: 50; background: var(--rs-deep); color: var(--rs-on-dark); }
.rs-top-in { max-width: 560px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 6px 10px; min-height: var(--rs-top-h); }
.rs-close { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .14); border: 0; color: #fff;
  font-size: 16px; font-weight: 700; min-height: 44px; padding: 0 18px 0 14px; border-radius: 10px; }
.rs-close:hover { background: rgba(255, 255, 255, .22); }
.rs-close svg { width: 16px; height: 16px; }
.rs-pager { display: flex; align-items: center; }
.rs-pager-count { font-size: 13px; font-weight: 600; color: var(--rs-on-dark); padding: 0 2px; white-space: nowrap; }
.rs-arrow { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: none; border: 0;
  color: #fff; padding: 0; border-radius: 10px; }
.rs-arrow svg { width: 16px; height: 16px; }
.rs-arrow:disabled { color: rgba(182, 172, 232, .35); cursor: default; }

.rs-wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 260px; }

/* 2. Written line */
.rs-written { font-size: 12px; color: var(--rs-mute); padding: 12px 0 10px; min-height: 40px; }
.rs-notice { margin: 12px 0 0; padding: 10px 12px; background: var(--rs-soft); border-radius: 10px; font-size: 13px; font-weight: 500;
  color: var(--rs-ink); line-height: 1.4; }
.rs-notice + .rs-written { padding-top: 8px; }

/* 3. The card */
.rs-card { background: #fff; border: 1px solid var(--rs-line); border-radius: 12px; overflow: hidden; }
.rs-card-in { padding: 16px; }
.rs-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.rs-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--rs-royal); color: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
.rs-name { font-size: 14px; font-weight: 600; line-height: 1.25; }
.rs-byline { font-size: 12px; color: var(--rs-mute); line-height: 1.3; }
.rs-headline { font-size: 15px; font-weight: 600; line-height: 1.35; margin-bottom: 10px; word-break: break-word; }
.rs-body { font-size: 15px; line-height: 1.5; word-break: break-word; }
.rs-body p, .rs-p { margin: 0 0 10px; white-space: pre-wrap; }
.rs-body p:last-child { margin-bottom: 0; }
.rs-cta { margin-top: 10px; }
.rs-loading, .rs-failed { padding: 28px 16px; text-align: center; font-size: 13px; color: var(--rs-mute); }

/* Scrolling a note, the tile area or a field into view keeps the pinned bar (and the top bar) clear of it. */
.rs-note, .rs-area, .rs-mark, [data-edit] { scroll-margin-top: 72px; scroll-margin-bottom: calc(var(--rs-bar-h, 190px) + 16px); }

/* edit mode: the words become editable in place. 16px so a phone does not zoom in on focus. */
.rs-editing [data-edit] { outline: 1.5px dashed var(--rs-line); outline-offset: 4px; border-radius: 4px; white-space: pre-wrap; font-size: 16px; }
.rs-script { font-size: 16px; }
.rs-editing [data-edit]:focus { outline: 2px solid var(--rs-royal); }

/* 4. Sources strip */
.rs-sources { background: var(--rs-bg); border-top: 1px solid var(--rs-soft); }
.rs-src-toggle { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; padding: 12px 16px;
  font-size: 12px; font-weight: 500; color: var(--rs-mute); text-align: left; min-height: 44px; }
.rs-src-caret { display: inline-block; transition: transform .15s; font-size: 10px; }
.rs-src-open .rs-src-caret { transform: rotate(90deg); }
.rs-src-list { display: none; padding: 0 16px 14px; }
.rs-src-open .rs-src-list { display: block; }
.rs-src-head { font-size: 12px; font-weight: 600; color: var(--rs-ink); margin-bottom: 8px; }
.rs-src-item { padding: 8px 0; border-top: 1px solid var(--rs-soft); font-size: 12px; line-height: 1.4; }
.rs-src-item:first-of-type { border-top: 0; }
.rs-src-name { font-weight: 600; color: var(--rs-ink); }
.rs-src-title { color: var(--rs-ink); }
.rs-src-date { color: var(--rs-mute); }
.rs-src-item a { color: var(--rs-royal); font-weight: 600; text-decoration: none; word-break: break-all; }

/* 5. Tiles */
/* The type card and the first-time color panel (2026-10-29). */
.rs-typecard { margin: 14px 0 0; }
.rs-typecard-img { display: block; width: 100%; max-width: 540px; height: auto; aspect-ratio: 1 / 1; margin: 0 auto;
  border-radius: 12px; border: 1px solid var(--rs-line); background: var(--rs-soft); }
.rs-color-panel { background: #fff; border: 1px solid var(--rs-line); border-radius: 12px; padding: 16px; margin-top: 12px; }
.rs-color-title { font-size: 15px; font-weight: 700; color: var(--rs-ink); margin-bottom: 12px; }
.rs-swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.rs-swatch { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.rs-swatch-dot { position: absolute; right: 3px; bottom: 3px; width: 10px; height: 10px; border-radius: 50%; }
.rs-swatch-on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--rs-royal); }
.rs-swatch:disabled { opacity: .6; cursor: default; }
.rs-swatch-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rs-swatch-def { font-size: 11px; font-weight: 600; color: var(--rs-mute); }
.rs-color-line { font-size: 13px; color: var(--rs-mute); margin-top: 12px; line-height: 1.45; }
.rs-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 14px 0 0; }
.rs-tiles[data-count="3"] { grid-template-columns: repeat(3, 1fr); }
.rs-tile { min-height: 56px; background: #fff; border: 1px solid var(--rs-line); border-radius: 10px; padding: 8px 4px;
  text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.rs-tile-label { font-size: 12px; font-weight: 600; color: var(--rs-royal); line-height: 1.2; }
.rs-tile-sub { font-size: 11px; color: var(--rs-mute); line-height: 1.2; }
/* The open tile looks pressed in. Tap it again to fold it away. */
.rs-tile[aria-expanded="true"] { background: var(--rs-royal); border-color: var(--rs-royal);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, .35); transform: translateY(1px); }
.rs-tile[aria-expanded="true"] .rs-tile-label { color: #fff; }
.rs-tile[aria-expanded="true"] .rs-tile-sub { color: rgba(255, 255, 255, .82); }
.rs-area { display: none; margin-top: 10px; background: #fff; border: 1px solid var(--rs-line); border-radius: 12px; padding: 14px; }
.rs-area.rs-area-open { display: block; }
.rs-area-part { display: none; }
.rs-area-part.rs-on { display: block; }
.rs-tags { font-size: 13px; line-height: 1.6; color: var(--rs-ink); word-break: break-word; white-space: pre-wrap; }
.rs-tags-none { font-size: 13px; color: var(--rs-mute); }
.rs-script-label { font-size: 12px; font-weight: 600; color: var(--rs-mute); margin: 0 0 6px; }
.rs-area-line { font-size: 13px; color: var(--rs-mute); line-height: 1.5; margin: 0 0 12px; }
.rs-small { font-size: 12px; color: var(--rs-mute); margin-top: 6px; line-height: 1.4; }
.rs-script { font-size: 13px; line-height: 1.6; padding: 10px 12px; background: var(--rs-bg); border: 1.5px solid var(--rs-line);
  border-radius: 10px; white-space: pre-wrap; word-break: break-word; min-height: 44px; margin-bottom: 14px; outline: none; }
.rs-regen { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.rs-regen-left { font-size: 12px; color: var(--rs-mute); }
.rs-outline { min-height: 44px; padding: 0 16px; background: #fff; color: var(--rs-royal); border: 1.5px solid var(--rs-royal);
  border-radius: 10px; font-size: 14px; font-weight: 600; }
.rs-outline:disabled { opacity: .5; cursor: default; }
.rs-textbtn { background: none; border: 0; color: var(--rs-royal); font-size: 13px; font-weight: 600; padding: 12px 0 0; min-height: 44px; }
/* the old image controls, moved in here while the screen is open */
#rs-area-image #bc-image-block { margin-top: 0 !important; }
#rs-area-image #bc-img-desc-label { font-size: 14px !important; font-weight: 600 !important; color: var(--rs-ink) !important;
  line-height: 1.4 !important; margin: 0 0 8px !important; }
#rs-area-image #bc-img-desc { display: block; width: 100%; font-size: 16px !important; line-height: 1.5 !important; color: var(--rs-ink) !important;
  background: #fff !important; border: 1.5px solid #A9A2D6 !important; border-radius: 10px !important; padding: 12px !important;
  min-height: 112px !important; margin-bottom: 12px !important; caret-color: var(--rs-royal); outline: none; }
#rs-area-image #bc-img-desc:empty::before { content: attr(data-placeholder); color: var(--rs-grey); font-style: italic; pointer-events: none; }
#rs-area-image #bc-img-desc:focus { border-color: var(--rs-royal) !important; box-shadow: 0 0 0 3px rgba(59, 46, 140, .18); }
#rs-area-image #bc-gen-img, #rs-area-image #bc-img-regen { min-height: 44px; padding: 0 16px !important; background: #fff !important;
  color: var(--rs-royal) !important; border: 1.5px solid var(--rs-royal) !important; border-radius: 10px !important;
  font-size: 14px !important; font-weight: 600 !important; }

/* 6. Pinned bottom bar */
.rs-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid var(--rs-line);
  box-shadow: 0 -8px 24px rgba(36, 28, 87, .08); padding: 12px 16px 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.rs-bar-in { max-width: 560px; margin: 0 auto; }
.rs-typing .rs-bar { position: static; box-shadow: none; }
.rs-check { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rs-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--rs-grey); }
.rs-dot-green { background: var(--rs-green); }
.rs-dot-amber { background: var(--rs-amber); }
.rs-dot-grey { background: var(--rs-grey); }
.rs-check-text { flex: 1; font-size: 13px; font-weight: 600; line-height: 1.35; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-check-link { background: none; border: 0; padding: 8px 0 8px 8px; margin: -8px 0; font-size: 13px; font-weight: 500;
  color: var(--rs-royal); flex: none; min-height: 44px; }
.rs-approve { display: block; width: 100%; min-height: 52px; border: 0; border-radius: 10px; background: var(--rs-royal); color: #fff;
  font-size: 16px; font-weight: 600; }
.rs-approve:hover:not(:disabled) { background: var(--rs-royal-hover); }
.rs-approve:disabled { opacity: .7; cursor: default; }
.rs-bar-row { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.rs-quiet { background: none; border: 0; padding: 12px 10px 12px 0; min-height: 44px; font-size: 13px; font-weight: 600; color: var(--rs-royal); }
.rs-quiet-delete { color: var(--rs-red); }
.rs-quiet-mute { margin-left: auto; padding-right: 0; color: var(--rs-mute); font-weight: 400; font-size: 12px; }
.rs-done-title { font-size: 15px; font-weight: 600; color: var(--rs-green); text-align: center; }
.rs-done-sub { font-size: 13px; color: var(--rs-mute); text-align: center; margin: 4px 0 14px; }
.rs-done .rs-outline { width: 100%; margin-top: 10px; }

/* Sheets: the rules sheet and the on-record sheet */
.rs-scrim { display: none; position: fixed; left: 0; right: 0; bottom: 0; top: var(--rs-top-h, 56px); z-index: 30; background: rgba(36, 28, 87, .45); }
.rs-scrim.rs-on { display: block; }
.rs-sheet { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; width: 100%; max-width: 560px; margin: 0 auto;
  border-radius: 16px 16px 0 0; max-height: min(640px, 88dvh); overflow-y: auto; padding: 8px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  animation: rs-up .18s ease-out; }
#rs-panel.rs-sheet-open { overflow-y: hidden; }
@media (prefers-reduced-motion: reduce) { .rs-sheet { animation: none; } .rs-src-caret { transition: none; } }
.rs-sheet.rs-on { display: block; }
@keyframes rs-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.rs-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--rs-line); margin: 4px auto 12px; }
.rs-sheet-head { display: flex; align-items: flex-start; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--rs-soft); }
.rs-sheet-close { background: none; border: 0; color: var(--rs-royal); font-size: 13px; font-weight: 600; padding: 8px 0 8px 8px; margin: -8px 0; min-height: 44px; flex: none; }
.rs-confirm { display: none; position: fixed; left: 16px; right: 16px; top: 50%; transform: translateY(-50%); z-index: 45; max-width: 360px;
  margin: 0 auto; background: #fff; border-radius: 14px; padding: 20px 18px 16px; box-shadow: 0 12px 40px rgba(20, 14, 60, .35); }
.rs-confirm.rs-on { display: block; }
.rs-confirm-q { font-size: 16px; font-weight: 600; line-height: 1.4; margin: 0 0 16px; }
.rs-btn-delete { display: block; width: 100%; min-height: 48px; border: 0; border-radius: 10px; background: var(--rs-red); color: #fff;
  font-size: 15px; font-weight: 600; }
.rs-confirm .rs-outline { display: block; width: 100%; margin-top: 10px; min-height: 48px; }
.rs-sheet-note { font-size: 12px; color: var(--rs-mute); line-height: 1.5; padding: 12px 0; }
.rs-rule { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--rs-soft); font-size: 12px; line-height: 1.45; }
.rs-rule-tag { flex: none; min-width: 34px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.rs-rule-pass { color: var(--rs-green); }
.rs-rule-warn, .rs-rule-fail { color: var(--rs-amber); }
.rs-rule-info { color: var(--rs-mute); }
.rs-rule-text { flex: 1; min-width: 0; word-break: break-word; }
.rs-rule-msg { color: var(--rs-mute); }
.rs-sheet-h { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--rs-mute); padding: 14px 0 4px; }
.rs-onrecord-text { font-size: 15px; line-height: 1.55; padding: 8px 0 12px; }

/* Flags and notes (added with the flag work) */
.rs-mark { background: rgba(200, 129, 26, .18); border-bottom: 2px solid #C8811A; border-radius: 3px; cursor: pointer; color: inherit; }
.rs-note { background: #FFF8EE; border: 1px solid #F0D9B5; border-radius: 10px; padding: 12px; margin: 2px 0 12px; }
.rs-note-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #8A5A0E; margin-bottom: 6px; }
.rs-note-reason { font-size: 13px; line-height: 1.5; color: var(--rs-ink); }
.rs-note-cite { font-size: 12px; color: var(--rs-mute); margin-top: 2px; }
.rs-note-sugg { font-size: 13px; line-height: 1.5; color: var(--rs-ink); margin-top: 8px; }
.rs-note-kept { font-size: 12px; color: var(--rs-mute); margin-top: 8px; }
.rs-note-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.rs-btn-royal, .rs-btn-out { min-height: 44px; padding: 0 14px; border-radius: 10px; font-size: 13px; font-weight: 600; flex: 1 1 140px; }
.rs-btn-royal { background: var(--rs-royal); color: #fff; border: 1.5px solid var(--rs-royal); }
.rs-btn-royal:hover { background: var(--rs-royal-hover); }
.rs-btn-out { background: #fff; color: var(--rs-royal); border: 1.5px solid var(--rs-royal); }
@media (max-width: 420px) { .rs-btn-royal, .rs-btn-out { flex: 1 1 100%; } }
.rs-sheet .rs-note { margin: 8px 0; }

/* Toast that sits above the pinned bar and wraps on a phone */
#rs-toast { position: fixed; left: 16px; right: 16px; bottom: 210px; z-index: 1100; margin: 0 auto; max-width: 420px; text-align: center;
  background: var(--rs-deep); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 13px; font-weight: 500; line-height: 1.4;
  pointer-events: none; }

/* Notes stand out from rules that passed (2026-10-14). The notes come first, with their fixes. The rules that
   passed fold away behind "N rules passed". A warning row that is not a note keeps a strong amber mark. */
.rs-sheet .rs-note, .rs-record-notes .rs-note { border-left: 5px solid var(--rs-amber); background: #FFF3DF; border-color: #E8C58A; border-left-color: var(--rs-amber); }
.rs-sheet .rs-note-label, .rs-record-notes .rs-note-label { color: #7A4B05; font-size: 12px; }
.rs-sheet .rs-note-sugg, .rs-record-notes .rs-note-sugg { font-weight: 600; background: #fff; border: 1px solid #E8C58A; border-radius: 8px; padding: 8px 10px; }
.rs-sheet-h-notes { color: #7A4B05; font-weight: 700; }
.rs-rule-warn, .rs-rule-fail { color: #7A4B05; }
.rs-rule:has(.rs-rule-warn), .rs-rule:has(.rs-rule-fail) { background: #FFF3DF; border-left: 5px solid var(--rs-amber); padding-left: 8px; font-weight: 600; }
.rs-fold { border-top: 1px solid var(--rs-soft); margin-top: 6px; }
.rs-fold-toggle { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; padding: 12px 0; min-height: 44px;
  font-size: 13px; font-weight: 600; color: var(--rs-mute); text-align: left; }
.rs-fold-open .rs-src-caret { transform: rotate(90deg); }
.rs-fold-list { display: none; }
.rs-fold-open .rs-fold-list { display: block; }
.rs-tiles[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
.rs-tiles[data-count="1"] { grid-template-columns: 1fr; }

/* A record on file, opened to read. No count, no paging, no picture controls. */
.rs-record-notes { margin-top: 14px; }
.rs-readonly .rs-arrow { visibility: hidden; }
.rs-readonly #bc-img-desc-label, .rs-readonly #bc-img-desc, .rs-readonly #bc-gen-img, .rs-readonly #bc-img-regen-counter,
.rs-readonly #bc-img-remove, .rs-readonly #bc-img-regen, .rs-readonly #bc-img-remove-note { display: none !important; }
.rs-rec-status { margin: 0 0 10px; }
.rs-bar-in .rs-rec-flyer, .rs-rec-flyer { width: 100%; margin-top: 10px; }
