/* ── Review page layout ── */
.review-container {
    height: 100vh;
    overflow: hidden;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
}

.review-container main.review-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.review-filters {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-label {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.review-filters select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: var(--fs-sm);
    background: #fff;
    color: #333;
    min-width: 150px;
    height: 32px;
}

.review-filters select:focus {
    outline: none;
    border-color: #2563eb;
}

.review-project-title {
    font-size: 1.05em;
    font-weight: 700;
    color: #1a1a1a;
    padding: 12px 24px 0;
}

.review-project-label {
    font-weight: 500;
    font-size: var(--fs-sm);
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ── Tab panels ── */
.tab-panel {
    display: none;
    flex: 1;
    overflow: hidden;
}

.tab-panel.active {
    display: flex;
}

.tab-panel.layout-split {
    flex-direction: row;
}

.tab-panel.layout-single {
    flex-direction: column;
    align-items: center;
}

/* No tabs: single panel always active */
.review-main > .tab-panel:only-child {
    display: flex;
}

/* ── Groups within tabs ── */
.review-group {
    overflow-y: auto;
    padding: 20px 24px;
}

.review-group.position-left {
    flex: 1;
    border-right: 1px solid var(--line);
}

.review-group.position-right {
    width: 340px;
    flex-shrink: 0;
    background: #fafafa;
}

.review-group.position-full {
    width: 100%;
    max-width: 800px;
    flex: 1;
}

.group-heading {
    font-size: var(--fs-md);
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 16px;
}

/* ── Reviewer bar ── */
.reviewer-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--line);
    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: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.reviewer-name {
    font-size: var(--fs-md);
    font-weight: 600;
    color: #1a1a1a;
}

.reviewer-meta {
    font-size: var(--fs-xs);
    color: #999;
}

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

.progress-text {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    text-decoration: none;
}

.progress-text:hover {
    color: #2563eb;
}

.progress-round {
    font-size: var(--fs-xs);
    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: var(--ok);
    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: var(--muted);
    font-size: var(--fs-sm);
    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: var(--fs-xs);
    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: var(--fs-md);
    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: var(--fs-sm);
}

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

.queue-item.active {
    background: var(--line-soft);
    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: #2563eb; }
.queue-item-status.completed { background: var(--ok); }
.queue-item-status.skipped { background: #f5a623; }

.queue-item-num {
    font-size: var(--fs-xs);
    color: #bbb;
    min-width: 16px;
    text-align: right;
    flex-shrink: 0;
}

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

/* ── Tab bar ── */
.tab-bar {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    border-bottom: 1px solid #ddd;
    background: #f5f5f5;
    flex-shrink: 0;
}

.tab-btn {
    padding: 10px 24px;
    border: 1px solid transparent;
    border-bottom: none;
    background: none;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: #666;
    cursor: pointer;
    position: relative;
    border-radius: 6px 6px 0 0;
    margin-bottom: -1px;
    transition: background 0.15s, color 0.15s;
}

.tab-btn:hover {
    color: #1a1a1a;
    background: #eee;
}

.tab-btn.active {
    color: #1a1a1a;
    background: #fff;
    border-color: #ddd;
}

.tab-btn .tab-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ddd;
    color: #666;
    font-size: var(--fs-xs);
    font-weight: 600;
    margin-right: 6px;
}

.tab-btn.active .tab-step {
    background: #1a1a1a;
    color: #fff;
}

.tab-btn.completed .tab-step {
    background: var(--ok);
    color: #fff;
}

/* Tab navigation */
.tab-nav {
    display: flex;
    gap: 8px;
    margin: 16px 0 12px;
}

/* ── Main review area ── */

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

.book-label {
    font-size: var(--fs-xs);
    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: var(--fs-xs);
    font-weight: 500;
    background: #1a1a1a;
    color: #fff;
    flex-shrink: 0;
}

.book-secondary {
    font-size: var(--fs-xs);
    color: #999;
}

/* Content sections */
.content-section {
    margin-bottom: 16px;
    border: 1px solid var(--line);
    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 var(--line);
    cursor: default;
    user-select: none;
}

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

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

.section-label {
    font-size: var(--fs-xs);
    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: var(--fs-md);
    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: var(--fs-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #ccc;
    margin: 24px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
}

.answer-body {
    background: #f9fdf9;
    border-left: 3px solid var(--ok);
    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: var(--fs-xs);
    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: var(--fs-sm);
    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: var(--fs-sm);
    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: var(--fs-sm);
    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: var(--fs-md);
    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: var(--fs-sm);
    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;
}

/* ── (right panel styles now handled by .review-group.position-right) ── */

/* Boolean fields (checkboxes) */
.boolean-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
}

.boolean-row .boolean-text { flex: 1; }
.boolean-row.unanswered { background: #fef3c7; }

.boolean-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: var(--fs-sm);
    transition: background 0.1s;
}

.boolean-label:hover {
    background: var(--line-soft);
}

.boolean-radio {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
    cursor: pointer;
    flex-shrink: 0;
}

.boolean-radio:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-radius: 3px;
}

.boolean-text {
    font-size: var(--fs-md);
    color: #333;
}

/* Select fields */
.select-section {
    margin-bottom: 16px;
}

.select-label {
    display: block;
    font-size: var(--fs-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #999;
    margin-bottom: 6px;
}

.select-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: var(--fs-md);
    font-family: inherit;
    color: #333;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s;
}

.select-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

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

.feedback-label {
    display: block;
    font-size: var(--fs-xs);
    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: var(--fs-md);
    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: var(--fs-xs);
    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: var(--muted);
    font-size: var(--fs-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s;
}

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

.decision-btn.yes.selected {
    background: var(--ok);
    border-color: var(--ok);
    color: #fff;
}

.decision-btn.no.selected {
    background: var(--bad);
    border-color: var(--bad);
    color: #fff;
}

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

/* Submit row */
.submit-row {
    display: flex;
    gap: 8px;
    padding: 16px 0;
    margin-top: 12px;
    border-top: 1px solid var(--line);
}

.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: var(--fs-md);
    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: var(--muted);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: var(--fs-md);
    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: var(--fs-xs);
    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: var(--fs-md);
}

/* ── Submit flash animation ── */
@keyframes submitFlash {
    0% { background: var(--ok); }
    100% { background: #1a1a1a; }
}

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

/* ── Responsive ── */
@media (max-width: 860px) {
    .tab-panel.layout-split {
        flex-direction: column;
    }
    .review-group.position-left {
        border-right: none;
        border-bottom: 1px solid var(--line);
    }
    .review-group.position-right {
        width: 100%;
    }
    .reviewer-bar {
        flex-wrap: wrap;
        gap: 10px;
    }
    .progress-compact {
        margin-left: 0;
        order: 3;
        width: 100%;
    }
    .progress-bar-mini {
        flex: 1;
    }
}
