/* 문제은행 편집기 v2: 검토 중심의 촘촘한 배치. v1 CSS 뒤에 불러와 덮어쓴다. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

body.review-v2 { font-size: 15px; }
body.review-v2 .editor-app { display: flex; flex-direction: column; height: 100dvh; min-height: 0; overflow: hidden; }

/* ---------- 머리줄 한 줄 ---------- */
.v2-header { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; padding: 6px 12px; border-bottom: 1px solid #cbdce0; background: #fff; }
.v2-header h1 { flex: 0 0 auto; margin: 0; font-size: 18px; line-height: 1.2; white-space: nowrap; }
.v2-header h1 span { margin-left: 4px; padding: 1px 6px; border-radius: 6px; background: var(--editor-gold-pale); color: #8a5a12; font-size: 12px; vertical-align: middle; }
.v2-header .source-badge { flex: 0 0 auto; min-height: 0; padding: 2px 8px; font-size: 12px; }
.v2-header .cloud-strip { flex: 1 1 auto; min-width: 0; margin: 0; padding: 2px 6px; border: 0; background: transparent; font-size: 12px; }
.v2-header .cloud-actions button { min-height: 26px; padding: 2px 7px; font-size: 12px; }
.v2-header-right { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; }
.v2-header-right .storage-status, .v2-header-right .edit-status { max-width: 190px; overflow: hidden; color: var(--editor-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.v2-header-right .header-button, .v2-header-right summary { min-height: 28px; padding: 3px 9px; font-size: 12px; }
.v2-header-right .storage-more { position: relative; }
.v2-header-right .storage-more-menu { right: 0; left: auto; z-index: 30; }

/* ---------- 세 칸 배치: 목록 | 검토·편집(넓게) | 미리보기(작게) ---------- */
body.review-v2 .editor-workspace { flex: 1 1 0; display: grid; grid-template-columns: 250px minmax(0, 1fr) clamp(320px, 27vw, 470px); gap: 8px; width: 100%; max-width: none; min-height: 0; margin: 0; padding: 8px; }
body.review-v2 .workspace-pane { min-height: 0; border-radius: 10px; box-shadow: 0 2px 8px rgba(19, 55, 72, .07); }

/* ---------- 목록 ---------- */
.v2-bank-top { display: grid; flex: 0 0 auto; gap: 6px; padding: 8px; border-bottom: 1px solid #e1e9eb; }
.v2-bank-title { display: flex; align-items: baseline; justify-content: space-between; }
.v2-bank-title strong { font-size: 15px; }
.v2-bank-title .result-count { font-size: 12px; }
.v2-workspace-select select, body.review-v2 .search-control input { width: 100%; min-height: 30px; padding: 3px 6px; font-size: 13px; }
.v2-status-tabs, .v2-unit-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.v2-tab { padding: 2px 7px; border: 1px solid #c4d7db; border-radius: 999px; background: #fff; color: #36586a; font-size: 12px; font-weight: 700; line-height: 1.6; }
.v2-tab b { font-weight: 900; }
.v2-tab.is-active { border-color: var(--editor-blue); background: var(--editor-blue); color: #fff; }
.v2-tab.is-unreviewed:not(.is-active) b { color: #6b7a83; }
.v2-tab.is-revise:not(.is-active) b { color: #b0631a; }
.v2-tab.is-approved:not(.is-active) b { color: #23794f; }
.v2-tab.is-excluded:not(.is-active) b { color: #9a4a3c; }
body.review-v2 .filter-form { display: grid; gap: 5px; }
body.review-v2 .filter-details summary { font-size: 12px; }
body.review-v2 .filter-details .workbench-buttons { margin-top: 6px; }
body.review-v2 .question-list { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 6px; }
body.review-v2 .question-list-item { gap: 2px; margin-bottom: 4px; padding: 6px 8px; border-radius: 8px; }
body.review-v2 .item-code { font-size: 12px; }
body.review-v2 .item-status { font-size: 11px; }
body.review-v2 .item-prompt { display: -webkit-box; overflow: hidden; font-size: 13px; line-height: 1.4; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
body.review-v2 .item-meta { display: none; }

/* ---------- 검토·편집 칸 ---------- */
body.review-v2 .edit-pane .editor-content { min-height: 0; overflow: auto; padding: 0 12px 24px; }
.v2-review { display: grid; gap: 8px; max-width: 980px; }
.v2-reviewbar { position: sticky; top: 0; z-index: 5; display: grid; gap: 6px; margin: 0 -12px; padding: 8px 12px; border-bottom: 1px solid #d9e5e8; background: rgba(255, 255, 255, .97); }
.v2-reviewbar-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.v2-qid { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.v2-qid strong { font-size: 17px; }
.v2-qid span { color: var(--editor-muted); font-size: 13px; }
.v2-nav { display: flex; gap: 4px; }
.v2-nav button { min-height: 28px; padding: 2px 10px; border: 1px solid #b9d2d7; border-radius: 7px; background: #fff; font-size: 13px; font-weight: 700; }
.v2-status-buttons { display: flex; flex-wrap: wrap; gap: 5px; }
.v2-status { min-width: 74px; min-height: 32px; padding: 3px 12px; border: 1.5px solid #c4d3d7; border-radius: 8px; background: #fff; color: #4d6470; font-size: 14px; font-weight: 800; }
.v2-status.is-approved.is-current { border-color: #23794f; background: #23794f; color: #fff; }
.v2-status.is-revise.is-current { border-color: #c06d1d; background: #c06d1d; color: #fff; }
.v2-status.is-excluded.is-current { border-color: #9a4a3c; background: #9a4a3c; color: #fff; }
.v2-status.is-unreviewed.is-current { border-color: #6b7a83; background: #6b7a83; color: #fff; }
.v2-status:not(.is-current):hover { border-color: var(--editor-blue); }
.v2-auto { display: flex; align-items: center; gap: 5px; color: var(--editor-muted); font-size: 12px; }
.v2-memo-slot .form-field { grid-template-columns: 70px minmax(0, 1fr); align-items: start; gap: 6px; }
.v2-memo-slot .form-field > span { padding-top: 6px; font-size: 13px; font-weight: 800; }

.v2-sec { padding: 8px 10px 10px; border: 1px solid #dfe8ea; border-radius: 9px; background: #fff; }
.v2-sec-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.v2-sec-head h4 { margin: 0; color: var(--editor-blue-dark); font-size: 14px; }
.v2-sec-head span { color: var(--editor-muted); font-size: 12px; }
details.v2-sec > summary { margin-bottom: 0; cursor: pointer; list-style: revert; }
details.v2-sec[open] > summary { margin-bottom: 6px; }
.v2-sec-body { display: grid; gap: 6px; }
.v2-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.v2-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.v2-sec-source label:has(textarea), .v2-sec-more label:has(textarea) { grid-column: 1 / -1; }
.v2-sec-prompt { border-color: #b8d6df; background: #f8fcfd; }
.v2-sec-answers { border-color: #b8d6df; background: #f8fcfd; }

/* 칸 이름은 왼쪽에 작게, 입력은 오른쪽에 */
.v2-sec .editor-field, .v2-sec .form-field { display: grid; gap: 2px; }
.v2-sec .editor-label, .v2-sec .form-field > span { color: #557080; font-size: 12px; font-weight: 800; }
.v2-sec-prompt .editor-label { display: none; }
.v2-review textarea { min-height: 38px !important; padding: 6px 8px !important; overflow: hidden; resize: none !important; font-size: 15px !important; line-height: 1.5 !important; }
.v2-sec-prompt textarea { font-size: 17px !important; font-weight: 700; }
.v2-review input[type="text"], .v2-review select { min-height: 32px; padding: 3px 7px; font-size: 14px; }
.v2-readonly { display: grid; gap: 2px; font-size: 12px; }
.v2-readonly span { color: #557080; font-weight: 800; }
.v2-readonly b { padding: 6px 8px; border: 1px solid #e1e8ea; border-radius: 8px; background: #f5f8f8; font-weight: 500; font-size: 14px; }

/* 보기·카드 행 */
.v2-sec-answers .type-form { display: grid; gap: 6px; }
.v2-sec-answers .form-grid-two { grid-template-columns: auto auto; justify-content: start; gap: 12px; }
.v2-sec-answers .form-grid-two .form-field { grid-template-columns: auto auto; align-items: center; gap: 6px; }
.v2-sec-answers .form-check { min-height: 0; }
.v2-sec-answers .array-heading { margin: 4px 0 0; font-size: 13px; }
.v2-sec-answers .array-row { gap: 6px; padding: 4px 6px; border-radius: 7px; }
.v2-sec-answers .choice-row { grid-template-columns: 22px minmax(0, 1fr) auto auto; row-gap: 3px; }
.v2-sec-answers .choice-row input[data-struct-field="choiceText"] { grid-column: 2; font-size: 15px; font-weight: 700; }
.v2-sec-answers .choice-row input[data-struct-field="choiceRationale"] { grid-column: 2 / -1; grid-row: 2; min-height: 28px; color: #5d7480; font-size: 13px; }
.v2-sec-answers .choice-row .array-remove { grid-column: 4; grid-row: 1; white-space: nowrap; }
.v2-sec-answers .choice-row .inline-check { grid-column: 3; grid-row: 1; }
.v2-sec-answers .choice-row:has(input[data-struct-field="choiceCorrect"]:checked) { border-color: #3c9a6b; background: #effaf3; }
.v2-sec-answers .row-id { display: none; }
.v2-sec-answers .array-add, .v2-sec-answers .array-remove { min-height: 28px; padding: 2px 8px; font-size: 12px; }
.v2-sec-answers .validation-panel { margin-top: 2px; padding: 5px 8px; font-size: 12px; }
.v2-sec-answers .validation-panel.is-valid span { display: none; }

/* 사진 */
.v2-sec-photos .photo-card { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.v2-sec-photos .photo-row { grid-template-columns: 150px minmax(0, 1fr); gap: 8px; padding: 6px; }
.v2-sec-photos .photo-row-heading { font-size: 12px; }
.v2-sec-photos .photo-row-actions { gap: 4px; }
.v2-sec-photos .photo-row-actions > * { min-height: 26px; padding: 1px 6px; font-size: 12px; }
.v2-photo-tools { margin-top: 6px; font-size: 13px; }
.v2-photo-tools > summary { color: var(--editor-blue-dark); font-weight: 800; cursor: pointer; }

/* ---------- 미리보기(작게, 잘림 없이 축소) ---------- */
.v2-preview-top { display: flex; align-items: center; gap: 6px; padding: 8px; border-bottom: 1px solid #e1e9eb; }
.v2-preview-top strong { flex: 1 1 auto; font-size: 15px; }
.v2-preview-top select { min-height: 28px; padding: 2px 6px; border: 1px solid #b9d2d7; border-radius: 7px; font-size: 12px; }
.v2-preview-top .preview-open-button { min-height: 28px; padding: 2px 8px; font-size: 12px; }
body.review-v2 .iframe-preview { flex: 1 1 auto; min-height: 0; overflow: hidden; padding: 8px; }
body.review-v2 .preview-viewport-shell { position: relative; height: auto; margin: 0 auto; overflow: hidden; border-radius: 8px; box-shadow: none; }
body.review-v2 .preview-iframe { position: absolute; top: 0; left: 0; margin: 0 !important; transform-origin: 0 0; }
.v2-preview-note { flex: 0 0 auto; margin: 0; padding: 0 10px 8px; color: var(--editor-muted); font-size: 11px; }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 1199px) {
  body.review-v2 .editor-workspace { grid-template-columns: 220px minmax(0, 1fr) 300px; }
  .v2-header-right .edit-status { display: none; }
}
@media (max-width: 999px) {
  .v2-header { flex-wrap: wrap; }
  body.review-v2 .editor-workspace { display: block; padding: 6px 6px 64px; }
  .v2-grid-2, .v2-grid-3 { grid-template-columns: 1fr; }
}
