* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #222;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    padding: 30px;
}

.header h1 {
    color: #333;
    border-bottom: 3px solid #667eea;
    padding-bottom: 15px;
    margin: 0 0 15px 0;
}

.stats-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.stats-box {
    background: #f8f9fa;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
}
.stats-box strong { color: #667eea; }

.status-banner {
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 500;
}
.status-banner.submitted {
    background: #e0f7fa;
    border: 1px solid #00acc1;
    color: #00838f;
}

.priority-reminder {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}
.priority-reminder h3 { margin-top: 0; color: #1976d2; }
.priority-reminder ul { margin: 0; padding-left: 20px; }

.cards-container { display: flex; flex-direction: column; gap: 20px; }

.card {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr);
    gap: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}
.card.rejected {
    background: #fbe9e7;
    border-color: #ff7043;
}

.card .left { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card .right { min-width: 0; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.card-header .idx { font-weight: bold; color: #667eea; }
.save-indicator { font-size: 12px; color: #888; min-width: 80px; text-align: right; }
.save-indicator.saving { color: #f9a825; }
.save-indicator.saved  { color: #2e7d32; }
.save-indicator.error  { color: #c62828; }

.field-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
}

textarea, input[type="text"], input[type="date"], input[type="number"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
}
textarea { resize: vertical; line-height: 1.45; white-space: pre-wrap; overflow: hidden; }
textarea.quote-text { min-height: 140px; }
textarea.quote-title { min-height: 40px; }
textarea.notes { min-height: 60px; background: #fffef0; }

input[type="number"] { width: 70px; }

.row-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.row-meta label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: #666; }

/* Neighbors panel */
.neighbors-panel {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.neighbors-list { display: flex; flex-direction: column; gap: 8px; }

.corpus-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
}
.corpus-badge.corpus-queue    { background: #e3f2fd; color: #1565c0; }
.corpus-badge.corpus-discourse{ background: #ede7f6; color: #5e35b1; }

.neighbor {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 10px;
    font-size: 13px;
}
.neighbor .sim-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.neighbor .sim-badge {
    background: #eceff1;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.neighbor .sim-badge.high     { background: #ffcdd2; color: #b71c1c; }
.neighbor .sim-badge.moderate { background: #fff9c4; color: #795548; }
.neighbor .sim-badge.low      { background: #c8e6c9; color: #1b5e20; }

.neighbor .attribution {
    font-size: 15px;
    color: #1a237e;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}
.neighbor .body {
    margin: 6px 0;
    color: #333;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.neighbor .actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 12px;
}
.btn-reject-dup {
    background: #ef5350;
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.btn-reject-dup:hover { background: #d32f2f; }
.btn-unreject {
    background: #43a047;
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.footer {
    margin-top: 30px;
    display: flex;
    gap: 10px;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.btn {
    padding: 10px 22px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
}
.btn-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(102,126,234,0.35); }
.btn-primary:disabled { background: #999; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background: #eceff1; color: #333; border: 1px solid #ccc; }
.btn-secondary:hover { background: #cfd8dc; }

.copy-status { color: #2e7d32; font-weight: 600; font-size: 14px; }

.readonly input, .readonly textarea, .readonly button:not(.btn-unreject):not(.tab-btn) { pointer-events: none; opacity: 0.6; }

.loading { color: #888; font-style: italic; }

@media (max-width: 1000px) {
    .card { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------
 * Verbatim source (soft-warn for altered candidates)
 * Yellow box for a transcript window; red box for fabrication sentinel.
 * --------------------------------------------------------- */
.verbatim-box {
    margin-top: 8px;
    background: #fff9e6;
    border: 1px dashed #e0c060;
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.verbatim-box.verbatim-alarm {
    background: #ffebee;
    border: 1px dashed #c62828;
}
.verbatim-box .field-label { color: #8b6f00; }
.verbatim-box.verbatim-alarm .field-label { color: #b71c1c; font-weight: 600; }
.verbatim-source {
    width: 100%;
    min-height: 90px;
    padding: 8px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: #fff;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    white-space: pre-wrap;
    cursor: default;
}
.verbatim-banner {
    background: #fff8e1;
    border-left: 4px solid #f9a825;
    color: #8b6f00;
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: 4px;
    font-weight: 500;
}
