#codex-figure-routine{width:min(1100px,94vw);max-height:90vh;overflow:auto;background:var(--bg,#e6e7e3);color:var(--text,#222);border:1px solid var(--border,#aaa);border-radius:6px;padding:16px}
#codex-figure-routine header,.cr-controls{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:12px}
#codex-figure-routine header strong{flex:1;font-size:18px}
#codex-figure-routine button,#codex-figure-routine input,#codex-figure-routine select{font:inherit;padding:6px;border:1px solid var(--border,#aaa);border-radius:3px}
#cr-limit{width:70px}#cr-code{width:260px;max-width:80vw}
#cr-target-articles{max-height:320px;overflow:auto}
.cr-target-row{display:grid;grid-template-columns:minmax(0,1fr) 9em;gap:12px;padding:7px 0;line-height:1.5}
.cr-target-row>span{overflow-wrap:anywhere}
.cr-target-state{text-align:right;font-size:12px}
.cr-target-row[data-state="registered"],.cr-target-row[data-state="published"]{color:#727670}
@media(max-width:600px){.cr-target-row{grid-template-columns:minmax(0,1fr) 6em;gap:6px}}
#codex-figure-routine section{border-top:1px solid var(--border,#aaa);padding:10px 0}
.cr-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr));gap:12px}
.cr-grid figure{margin:0;min-width:0}.cr-grid img{display:block;width:100%;height:auto;max-height:700px;object-fit:contain}.cr-grid figcaption,.cr-grid p{overflow-wrap:anywhere}.cr-grid figcaption{font-weight:700;margin-bottom:6px}
#codex-figure-routine .cr-image-open{display:block;width:100%;padding:0;border:0;background:transparent;cursor:zoom-in}
.cr-image-open:focus-visible{outline:2px solid currentColor;outline-offset:3px}
#cr-image-preview{box-sizing:border-box;width:min(1000px,96vw);height:94vh;max-height:94vh;padding:12px;border:1px solid var(--border,#aaa);border-radius:6px;background:var(--bg,#e6e7e3);color:var(--text,#222);overflow:hidden}
#cr-image-preview[open]{display:flex;flex-direction:column}
#cr-image-preview::backdrop{background:rgba(0,0,0,.65)}
#cr-image-preview header{display:flex;align-items:center;gap:12px;flex:none;margin-bottom:10px}
#cr-image-preview strong{flex:1;min-width:0;font-size:16px;overflow-wrap:anywhere}
#cr-image-preview button{flex:none;width:36px;height:36px;font:inherit;font-size:24px;cursor:pointer;border:1px solid var(--border,#aaa);border-radius:3px;background:var(--bg,#e6e7e3);color:inherit}
.cr-image-content{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}
.cr-image-content img{display:block;width:100%;height:auto}
#codex-figure-routine .cr-image-open,.cr-image-content{background:#f3f0e8}
.cr-grid img,.cr-image-content img{background:#f3f0e8;filter:contrast(.84) brightness(.97) sepia(.04) saturate(.9);opacity:.84}
