/* ── Review page layout ── */
.review-container {
    max-width: 1200px;
    height: 100vh;
    overflow: hidden;
    border-left: 1px solid #eee;
    border-right: 1px solid #eee;
}

.review-container main.review-main {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

/* ── Reviewer bar ── */
.reviewer-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
    flex-shrink: 0;
}

.reviewer-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reviewer-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #1a1a1a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.reviewer-name {
    font-size: 0.9em;
    font-weight: 600;
    color: #1a1a1a;
}

.reviewer-meta {
    font-size: 0.78em;
    color: #999;
}

.progress-compact {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-text {
    font-size: 0.82em;
    font-weight: 600;
    color: #6b6b6b;
    white-space: nowrap;
}

.progress-round {
    font-size: 0.75em;
    color: #999;
    padding: 2px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    white-space: nowrap;
}

.progress-bar-mini {
    width: 100px;
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: #2d9d5a;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.reviewer-actions {
    display: flex;
    gap: 4px;
}

.btn-ghost {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #6b6b6b;
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-ghost:hover {
    background: #fff;
    color: #1a1a1a;
    border-color: #ccc;
}

/* ── Queue dropdown ── */
.queue-dropdown {
    position: relative;
}

.queue-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    z-index: 100;
}

.queue-menu.open {
    display: block;
}

.queue-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #999;
    padding: 10px 14px 6px;
}

.queue-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9em;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.queue-legend-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-left: 6px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 0.85em;
}

.queue-item:hover {
    background: #f5f5f5;
}

.queue-item.active {
    background: #f0f0f0;
    font-weight: 500;
}

.queue-item.completed {
    color: #999;
}

.queue-item-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.queue-item-status.pending { background: #e0e0e0; }
.queue-item-status.current { background: #dc4c3e; }
.queue-item-status.completed { background: #2d9d5a; }
.queue-item-status.skipped { background: #f5a623; }

.queue-item-num {
    font-size: 0.75em;
    color: #bbb;
    min-width: 16px;
    text-align: right;
    flex-shrink: 0;
}

.queue-item-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Main review area ── */

/* ── Content panel (left) ── */
.review-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    border-right: 1px solid #eee;
}

/* Book strip */
.book-strip {
    margin-bottom: 18px;
}

.book-label {
    font-size: 0.72em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #bbb;
    margin-bottom: 3px;
}

.book-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 3px;
}

.book-title {
    font-size: 1.05em;
    font-weight: 600;
    color: #1a1a1a;
}

.meta-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 500;
    background: #1a1a1a;
    color: #fff;
    flex-shrink: 0;
}

.book-secondary {
    font-size: 0.78em;
    color: #999;
}

/* Content sections */
.content-section {
    margin-bottom: 16px;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #fafafa;
    border-bottom: 1px solid #eee;
    cursor: default;
    user-select: none;
}

.section-header:has(.toggle-icon) {
    cursor: pointer;
}

.section-header:has(.toggle-icon):hover {
    background: #f5f5f5;
}

.section-label {
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #999;
}

.toggle-icon {
    transition: transform 0.2s;
}

.content-section.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.content-section.collapsed .section-body {
    display: none;
}

.section-body {
    padding: 14px;
    font-size: 0.92em;
    line-height: 1.65;
    color: #333;
}

.section-body p {
    margin-bottom: 8px;
}

.section-body p:last-child {
    margin-bottom: 0;
}

.passage-body {
    max-height: 160px;
    overflow-y: auto;
    background: #fcfcfc;
}

/* Reference divider */
.reference-divider {
    font-size: 0.72em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #ccc;
    margin: 24px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}

.answer-body {
    background: #f9fdf9;
    border-left: 3px solid #2d9d5a;
    font-weight: 500;
}

/* Edit controls */
.search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.search-btn:hover {
    background: #eef4ff;
    color: #4285f4;
}

.tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.tool-btn-label {
    font-size: 0.78em;
    font-weight: 700;
    line-height: 1;
}

.tool-btn.latex-check-btn:hover {
    background: #f3eef8;
    color: #7c4dff;
}

/* Copied toast on tool buttons */
.tool-btn.copied,
.tool-btn.copied:hover {
    background: #1a1a1a;
    color: #fff;
}

.edit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.edit-btn:hover {
    background: #eee;
    color: #666;
}

.content-section.editing .edit-btn {
    background: #1a1a1a;
    color: #fff;
}

.section-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.edited-badge {
    font-size: 0.82em;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: #f5a623;
    margin-left: 6px;
}

.edit-area {
    display: block;
    width: 100%;
    min-height: 120px;
    padding: 14px;
    border: none;
    border-top: 1px dashed #ddd;
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.84em;
    line-height: 1.6;
    color: #333;
    background: #fffef5;
    resize: vertical;
}

.edit-area:focus {
    outline: none;
    background: #fffde7;
}

.content-section.editing .section-body {
    display: none;
}

.content-section.editing .edit-area {
    display: block !important;
}

/* ── Consistency hint ── */
.consistency-hint {
    font-size: 0.82em;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: #e67e22;
    margin-left: 4px;
    padding: 1px 7px;
    background: #fef9f2;
    border: 1px solid #f5d9b3;
    border-radius: 4px;
}

/* ── Diff view ── */
.diff-toggle {
    background: none;
    border: 1px solid #e8d5a0;
    border-radius: 3px;
    color: #b8860b;
    font-size: 0.88em;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    padding: 0 5px;
    margin-left: 4px;
    transition: all 0.15s;
}

.diff-toggle:hover {
    background: #fef5e0;
    border-color: #d4a844;
}

.diff-toggle.active {
    background: #f5a623;
    border-color: #f5a623;
    color: #fff;
}

.diff-view {
    padding: 12px 14px;
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.82em;
    line-height: 1.6;
    background: #fafafa;
    border-top: 1px dashed #ddd;
    white-space: pre-wrap;
    word-break: break-word;
}

.diff-add {
    background: #d4edda;
    color: #155724;
    padding: 1px 2px;
    border-radius: 2px;
}

.diff-del {
    background: #f8d7da;
    color: #721c24;
    text-decoration: line-through;
    padding: 1px 2px;
    border-radius: 2px;
}

.content-section.show-diff .section-body {
    display: none;
}

.content-section.show-diff .diff-view {
    display: block !important;
}

/* ── Rubric panel (right) ── */
.review-rubric {
    width: 340px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
}

.rubric-header {
    font-size: 0.95em;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 16px;
}

/* Criteria list */
.criteria-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 18px;
}

.criterion-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    transition: background 0.1s;
}

.criterion-row:hover {
    background: #f0f0f0;
}

.criterion-row.focused {
    background: #f0f0f0;
    box-shadow: inset 2px 0 0 #dc4c3e;
}

.criterion-toggles {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.criterion-btn {
    width: 30px;
    height: 26px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fff;
    color: #999;
    font-size: 0.72em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.criterion-btn:hover {
    border-color: #ccc;
}

.criterion-btn.yes.selected {
    background: #2d9d5a;
    border-color: #2d9d5a;
    color: #fff;
}

.criterion-btn.no.selected {
    background: #dc4c3e;
    border-color: #dc4c3e;
    color: #fff;
}

.criterion-label {
    font-size: 0.84em;
    color: #333;
    flex: 1;
}

/* Feedback */
.feedback-section {
    margin-bottom: 16px;
}

.feedback-label {
    display: block;
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #999;
    margin-bottom: 6px;
}

.feedback-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.88em;
    font-family: inherit;
    color: #333;
    background: #fff;
    resize: vertical;
    transition: border-color 0.15s;
}

.feedback-textarea:focus {
    outline: none;
    border-color: #ccc;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.03);
}

/* Decision */
.decision-section {
    margin-bottom: 18px;
}

.decision-label {
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #999;
    margin-bottom: 8px;
}

.decision-buttons {
    display: flex;
    gap: 6px;
}

.decision-btn {
    flex: 1;
    padding: 9px 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    color: #6b6b6b;
    font-size: 0.88em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s;
}

.decision-btn:hover {
    border-color: #ccc;
    color: #333;
}

.decision-btn.yes.selected {
    background: #2d9d5a;
    border-color: #2d9d5a;
    color: #fff;
}

.decision-btn.no.selected {
    background: #dc4c3e;
    border-color: #dc4c3e;
    color: #fff;
}

.decision-btn.other.selected {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #fff;
}

/* Submit row */
.submit-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.btn-primary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.88em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover {
    background: #333;
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 16px;
    background: #fff;
    color: #6b6b6b;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.88em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-secondary:hover {
    color: #1a1a1a;
    border-color: #ccc;
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Keyboard hint */
.keyboard-hint {
    text-align: center;
    font-size: 0.74em;
    color: #bbb;
}

.keyboard-hint kbd {
    display: inline-block;
    padding: 1px 5px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.95em;
}

/* ── Submit flash animation ── */
@keyframes submitFlash {
    0% { background: #2d9d5a; }
    100% { background: #1a1a1a; }
}

.btn-primary.submitted {
    animation: submitFlash 0.4s ease;
}

/* ── Responsive ── */
@media (max-width: 860px) {
    .review-container main.review-main {
        flex-direction: column;
    }
    .review-content {
        border-right: none;
        border-bottom: 1px solid #eee;
    }
    .review-rubric {
        width: 100%;
    }
    .reviewer-bar {
        flex-wrap: wrap;
        gap: 10px;
    }
    .progress-compact {
        margin-left: 0;
        order: 3;
        width: 100%;
    }
    .progress-bar-mini {
        flex: 1;
    }
}
