/* Knowledge → «Проверка»: the one resolver for uncertain OCR values («Лист сверки»).
   Brief: .impeccable/surfaces/review-sheet.md. Tokens only from palette.css / design.css.
   Scope: .nav-badge / .tab-badge (hook markup), everything else under .rv-sheet.
   Amber (warning-*) means only "a human should check this". */

/* ---------------------------------------------------------------- badges (rail, bottom nav, Knowledge switch) */
.nav-badge{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:18px;padding:0 6px;margin-left:auto;border-radius:9px;background:var(--warning-300);color:var(--warning-800);font-size:11px;font-weight:600;line-height:1;font-variant-numeric:tabular-nums;letter-spacing:0}
.nav-btn:has(.nav-badge)::after{display:none}
@media(max-width:1350px) and (min-width:1200px),(max-width:850px){
 .nav-btn:has(.nav-badge){position:relative}
 .nav-badge{position:absolute;top:5px;left:50%;margin-left:3px;height:17px;min-width:18px;padding:0 5px;font-size:10px}
}
.knowledge-switch .tab-badge{display:inline-flex;align-items:center;min-width:20px;justify-content:center;margin-left:7px;padding:1px 6px;border-radius:6px;background:var(--warning-100);color:var(--warning-800);font-size:11px;font-weight:600;line-height:1.45;font-variant-numeric:tabular-nums;vertical-align:1px}

/* ---------------------------------------------------------------- sheet frame */
.rv-sheet{max-width:980px;--rv-strip:240px;font-variant-numeric:tabular-nums}
.rv-sheet .text-btn{min-height:32px;padding:4px 0;color:var(--plum-600)}
.rv-sheet .text-btn svg{color:var(--plum-500)}
.rv-sheet .text-btn:disabled{opacity:.45}
.rv-sheet [tabindex="-1"]:focus{outline:none}
.rv-sheet [tabindex="-1"]:focus-visible{outline:2px solid var(--plum-500);outline-offset:2px;border-radius:4px}

.rv-top{margin-bottom:6px}
.rv-top-line{display:flex;align-items:center;justify-content:space-between;gap:12px 20px;flex-wrap:wrap;min-height:44px}
.rv-title{font-size:17px;line-height:1.35;letter-spacing:-.02em;font-weight:600}
.rv-title span{color:var(--muted);font-weight:400}
.rv-tools{display:flex;align-items:center;gap:16px;margin-left:auto}
.rv-filters{display:flex;gap:4px}
.rv-filter{border:0;background:none;border-radius:7px;padding:6px 9px;min-height:32px;font-size:12px;color:var(--muted)}
.rv-filter b{font-weight:inherit;margin-left:5px}
.rv-filter:hover{background:var(--plum-100);color:var(--plum-800)}
.rv-filter[aria-pressed=true]{background:var(--plum-pale);color:var(--plum);font-weight:500}
.rv-scope{font-size:13px;color:var(--muted);margin-top:4px;overflow-wrap:anywhere}
.rv-scope .text-btn{margin-left:4px}

.rv-keys{position:relative}
.rv-keys summary{list-style:none;display:inline-flex;align-items:center;gap:5px;min-height:32px;font-size:12px;color:var(--plum-600);cursor:pointer;border-radius:6px}
.rv-keys summary::-webkit-details-marker{display:none}
.rv-keys summary:hover{color:var(--plum-800)}
.rv-keys[open] summary{color:var(--ink)}
.rv-keys-list{position:absolute;right:0;top:calc(100% + 6px);z-index:5;width:max-content;max-width:min(380px,calc(100vw - 48px));display:grid;grid-template-columns:auto 1fr;gap:9px 16px;align-items:baseline;margin:0;padding:14px 16px;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 10px 30px oklch(from var(--plum-950) l c h / .12);font-size:12px}
.rv-keys-list dt{white-space:nowrap;color:var(--muted)}
.rv-keys-list dd{margin:0;color:var(--ink)}
.rv-sheet kbd{display:inline-block;min-width:20px;padding:1px 5px;border:1px solid var(--plum-200);border-bottom-width:2px;border-radius:5px;background:var(--plum-50);color:var(--plum-800);font:500 11px/1.4 'Golos Text',sans-serif;text-align:center}

/* ---------------------------------------------------------------- states around the list */
.rv-done{display:flex;align-items:center;gap:12px}
.rv-done-mark{color:var(--green);display:inline-flex}
.rv-done p{margin-top:2px;font-size:13px;color:var(--muted)}
.rv-empty{max-width:62ch;padding:6px 0 4px}
.rv-empty p{margin-top:8px;font-size:13px;line-height:1.65;color:var(--muted)}
.rv-load-error{padding:8px 0;font-size:13px;color:var(--ink)}
.rv-load-error .btn{margin-top:12px}
.rv-skel{height:12px;border-radius:6px;background:var(--plum-100)}
.rv-skel-title{width:32%;height:18px;margin:8px 0 26px}
.rv-skel-row{display:flex;gap:18px;align-items:center;padding:12px 0;border-bottom:1px solid var(--line)}
.rv-skel-strip{width:var(--rv-strip);height:40px;flex:none}
.rv-skel-lines{flex:1;display:flex;flex-direction:column;gap:9px}

/* ---------------------------------------------------------------- document and page groups */
.rv-doc{margin-top:26px}
.rv-doc:first-child{margin-top:14px}
.rv-doc-head{display:flex;align-items:center;gap:10px;min-height:32px;flex-wrap:wrap}
.rv-doc-icon{color:var(--plum-500);display:inline-flex}
.rv-doc-head h3{font-size:14px;line-height:1.4;font-weight:600;overflow-wrap:anywhere;min-width:0}
.rv-doc-meta{font-size:12px;color:var(--muted)}
.rv-doc-ok{display:inline-flex;align-items:center;gap:5px;color:var(--green)}
.rv-page-head{border-bottom:1px solid var(--line);padding:6px 0 6px}
.rv-page-line{display:flex;align-items:center;gap:6px 12px;flex-wrap:wrap;min-height:34px}
.rv-page-no{font-size:12px;font-weight:600;color:var(--ink)}
.rv-page-meta{font-size:12px;color:var(--muted)}
.rv-page-actions{display:flex;gap:4px 20px;margin-left:auto;flex-wrap:wrap}
.rv-confirm{display:flex;align-items:center;gap:10px 16px;flex-wrap:wrap;margin:6px 0 8px;padding:12px 14px;border-radius:10px;background:var(--plum-50);font-size:13px;line-height:1.55}
.rv-confirm p{flex:1 1 300px}
.rv-confirm-actions{display:flex;gap:8px;flex-wrap:wrap}

/* ---------------------------------------------------------------- rows */
.rv-row{border-bottom:1px solid var(--line)}
.rv-row-open{display:grid;grid-template-columns:var(--rv-strip) minmax(0,1fr) 20px;align-items:center;gap:18px;width:calc(100% + 16px);margin:0 -8px;padding:10px 8px;min-height:62px;border:0;border-radius:10px;background:none;text-align:left;font-size:13px;color:var(--ink)}
.rv-row-open:hover{background:var(--plum-50)}
.rv-row-open:hover .rv-row-go{color:var(--plum-700)}
.rv-row-open:active:not(:disabled){transform:none}
.rv-row-open:focus-visible{outline:3px solid var(--plum-500);outline-offset:0}
.rv-strip{display:block;height:40px;border-radius:6px;overflow:hidden;background:var(--plum-100)}
.rv-strip img{display:block;width:100%;height:100%;object-fit:cover}
.rv-row-main{display:flex;flex-direction:column;gap:2px;min-width:0}
.rv-row-label{font-size:12px;font-weight:600;color:var(--ink);overflow-wrap:anywhere}
.rv-alt{font-size:12px;color:var(--muted)}
.rv-alt-flag{color:var(--warning-800)}
.rv-row-error{display:inline-flex;align-items:center;gap:5px;font-size:12px;color:var(--red)}
.rv-row-go{color:var(--plum-400);display:inline-flex}

/* one-line proposal: the start is clipped when the line is long, the value never is */
.rv-line{display:flex;min-width:0;font-size:14px;line-height:1.5;white-space:nowrap}
.rv-line .rv-l{flex:0 1 auto;min-width:0;display:flex;justify-content:flex-end;overflow:hidden}
.rv-line .rv-l>span,.rv-read .rv-l>span{flex:none}
.rv-line .rv-l>span,.rv-line .rv-r,.rv-line .rv-tok,.rv-read .rv-l>span,.rv-read .rv-t,.rv-read .rv-r{white-space:pre}
.rv-line .rv-r{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}
.rv-line .rv-whole{overflow:hidden;text-overflow:ellipsis}
.rv-tok{flex:none;margin:0;padding:0 2px;border-radius:3px;background:var(--warning-100);box-shadow:inset 0 -2px 0 var(--warning-600);font-weight:500}
.rv-gap{flex:none;display:inline-block;width:58px;height:1.05em;margin:0 4px;border-bottom:1.5px dashed var(--warning-600)}

/* the open row: evidence, readings, decision */
.rv-row.is-active{margin:10px -18px;padding:18px 18px 16px;border-bottom:0;border-radius:14px;background:var(--plum-50)}
.rv-row.is-active+.rv-row{border-top:0}
.rv-row-head{display:flex;align-items:baseline;gap:4px 12px;flex-wrap:wrap}
.rv-row-head h4{margin:0;font-size:15px;line-height:1.4;font-weight:600;overflow-wrap:anywhere}
.rv-kind{font-size:12px;color:var(--muted)}
.rv-pos{margin-left:auto;font-size:12px;color:var(--muted)}
.rv-crop{margin-top:12px}
.rv-crop-scroll{width:fit-content;max-width:100%;overflow-x:auto;overflow-y:hidden;border:1px solid var(--line);border-radius:10px;background:var(--white);scrollbar-width:thin;overscroll-behavior-x:contain}
.rv-crop-scroll:focus-visible{outline:2px solid var(--plum-500);outline-offset:3px}
.rv-crop-img{display:block;max-width:none;image-rendering:auto}
.rv-crop-failed{display:flex;align-items:center;gap:10px 14px;flex-wrap:wrap;padding:14px 16px;border-radius:10px;background:var(--warning-100);color:var(--warning-800);font-size:13px;line-height:1.5}
.rv-crop-failed>svg{flex:none}
.rv-crop-failed p{flex:1 1 260px}
.rv-crop-failed .btn{background:var(--white);border:1px solid var(--warning-300);color:var(--warning-800)}
.rv-crop-cap{display:flex;align-items:center;gap:4px 18px;flex-wrap:wrap;margin-top:6px;font-size:12px;color:var(--muted)}
.rv-crop-cap>span{margin-right:auto}
.rv-crop-cap .text-btn[aria-pressed=true]{color:var(--ink);font-weight:500}

/* readings as aligned channels: every disputed value sits in the same column */
.rv-readings{display:grid;grid-template-columns:max-content minmax(0,max-content) max-content minmax(0,1fr);margin-top:14px;row-gap:2px}
.rv-read{grid-column:1/-1;display:grid;grid-template-columns:subgrid;align-items:baseline;padding:7px 10px;border-radius:8px;font-size:16px;line-height:1.5;white-space:nowrap;cursor:pointer;transition:background-color var(--fast)}
.rv-read:hover{background:var(--plum-100)}
.rv-read[aria-selected=true]{background:var(--plum-150)}
.rv-read-label{padding-right:20px;font-size:11px;line-height:1.3;color:var(--plum-600);white-space:nowrap;align-self:center}
.rv-read .rv-l{min-width:0;display:flex;justify-content:flex-end;overflow:hidden}
.rv-read .rv-t{padding:0 1px;font-weight:500;color:var(--ink)}
.rv-read .rv-r{min-width:0;overflow:hidden;text-overflow:ellipsis}
.rv-readings.is-plain{grid-template-columns:max-content minmax(0,1fr)}
.rv-read .rv-whole{min-width:0;white-space:normal;overflow-wrap:anywhere}
.rv-read .rv-miss{grid-column:2/-1;color:var(--plum-700);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rv-crop-failed+.rv-readings,.rv-crop:has(.rv-crop-failed)+.rv-readings{margin-top:16px}
.rv-d{background:var(--warning-100);color:var(--ink);border-radius:2px;box-shadow:inset 0 -2px 0 var(--warning-600);padding:0 1px}
.rv-empty-read{margin:4px 10px 0;font-size:12px;color:var(--muted)}

.rv-field-label{display:block;margin:16px 0 8px;font-size:12px;font-weight:500;color:var(--ink)}
.rv-edit{display:flex;align-items:center;gap:10px}
.rv-field{flex:1;min-width:0;min-height:48px;border:1px solid var(--plum-400);border-radius:10px;background:var(--white);color:var(--ink);padding:10px 14px;font-size:18px;line-height:1.35;letter-spacing:-.01em;font-variant-numeric:tabular-nums}
.rv-field:focus{border-color:var(--plum-500)}
.rv-field::selection{background:var(--plum-200);color:var(--plum-900)}
.rv-field::placeholder{font-size:15px}
.rv-edit .btn{min-height:48px;padding:0 16px;font-size:13px}
.rv-change{min-height:20px;margin-top:8px;font-size:13px;line-height:1.5;color:var(--ink)}
.rv-change s{color:var(--muted);text-decoration-color:var(--plum-400)}
.rv-change b{font-weight:600}
.rv-error{font-size:13px;line-height:1.5;color:var(--red)}
.rv-error:empty{display:none}

/* resolved in place */
.rv-row.is-done{display:flex;align-items:center;gap:10px;min-height:46px;padding:7px 0;font-size:13px}
.rv-done-icon{display:inline-flex;color:var(--green);width:16px;justify-content:center}
.rv-done-icon.is-gone{color:var(--muted)}
.rv-done-main{flex:1;min-width:0;display:flex;align-items:baseline;gap:2px 10px;flex-wrap:wrap}
.rv-done-val{font-weight:500}
.rv-done-note{font-size:12px;color:var(--muted)}
.rv-done-note s{text-decoration-color:var(--plum-400)}
.rv-reopen{flex:none}
.rv-spin{width:13px;height:13px;border-radius:50%;border:2px solid var(--plum-200);border-top-color:var(--plum-600);animation:rv-spin .8s linear infinite}

/* recently resolved */
.rv-recent{margin-top:36px;border-top:1px solid var(--line);padding-top:8px}
.rv-recent summary{display:flex;align-items:center;gap:8px;min-height:44px;font-size:13px;font-weight:600;cursor:pointer}
.rv-recent summary span{font-weight:400;color:var(--muted)}
.rv-recent ul{list-style:none;margin:0;padding:0}
.rv-recent-row{display:flex;align-items:center;gap:6px 16px;padding:9px 0;border-bottom:1px solid var(--line);flex-wrap:wrap}
.rv-recent-main{flex:1 1 280px;min-width:0;display:flex;flex-direction:column;gap:1px}
.rv-recent-text{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rv-recent-meta{font-size:12px;color:var(--muted);white-space:nowrap}

/* ---------------------------------------------------------------- motion: 8px over 220ms, as in the Laboratory */
.rv-row.is-fresh{animation:rv-reveal 220ms var(--ease)}
.rv-row.is-settling{animation:rv-settle 220ms var(--ease)}
@keyframes rv-reveal{from{transform:translateY(8px)}to{transform:none}}
@keyframes rv-settle{from{transform:translateY(-8px);opacity:.55}to{transform:none;opacity:1}}
@keyframes rv-spin{to{transform:rotate(1turn)}}

/* ---------------------------------------------------------------- tablet */
@media(max-width:1199px){.rv-sheet{--rv-strip:200px}}
@media(max-width:850px){
 .rv-sheet{--rv-strip:160px}
 .rv-row.is-active{margin:10px -12px;padding:16px 12px 14px}
}
/* ---------------------------------------------------------------- phone */
@media(max-width:650px){
 .rv-top-line{align-items:flex-start}
 .rv-tools{margin-left:0;width:100%}
 .rv-keys{display:none}
 .rv-filter,.rv-sheet .text-btn,.rv-keys summary{min-height:44px}
 .rv-row-open{grid-template-columns:minmax(0,1fr) 20px;gap:8px 12px;padding:12px 8px}
 .rv-strip{grid-column:1/-1;height:36px}
 .rv-row.is-active{margin:8px -12px;padding:14px 12px;border-radius:12px}
 .rv-readings{grid-template-columns:minmax(0,max-content) max-content minmax(0,1fr)}
 .rv-read{padding:6px 8px;font-size:15px}
 .rv-read-label{grid-column:1/-1;padding:0 0 1px}
 .rv-read .rv-miss{grid-column:1/-1}
 .rv-readings.is-plain{grid-template-columns:minmax(0,1fr)}
 .rv-edit{flex-wrap:wrap}
 .rv-field{flex:1 1 100%;font-size:16px}
 .rv-edit .btn{flex:1 1 0;min-height:44px}
 .rv-page-actions{margin-left:0;gap:0 18px}
 .rv-crop-cap{gap:0 16px}
 .rv-crop-cap>span{flex:1 0 100%}
 .rv-confirm .btn{min-height:44px}
 .rv-recent-meta{white-space:normal}
}
@media(pointer:coarse),(max-width:1024px){.rv-sheet .text-btn,.rv-filter,.rv-keys summary{min-height:44px}}
@media(prefers-reduced-motion:reduce){.rv-row.is-fresh,.rv-row.is-settling{animation:none}.rv-spin{animation:none;border-top-color:var(--plum-400)}.rv-read{transition:none}}
