*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8f9fb;
  --surface: #ffffff;
  --border: #e2e8f0;
  --primary: #1a1a2e;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --text: #1e293b;
  --text-muted: #64748b;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #059669;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }

.app-shell { max-width: 960px; margin: 0 auto; padding: 24px 16px; }

/* Header */
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 24px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.app-logo { font-size: 20px; font-weight: 700; color: var(--primary); letter-spacing: -0.5px; }
.app-logo span { color: var(--accent); }
.app-header-actions { display: flex; gap: 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); font-size: 14px; font-weight: 500; cursor: pointer; border: none; transition: background 0.15s, transform 0.1s; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 600; color: var(--primary); }

/* Case list */
.case-list { display: flex; flex-direction: column; gap: 12px; }
.case-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.case-item:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.08); }
.case-item-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.case-item-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 12px; }
.case-item-meta span { display: flex; align-items: center; gap: 4px; }

/* Section header */
.section-header { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 12px; }
.section-title { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }

/* Document list */
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.doc-icon { width: 36px; height: 36px; background: var(--bg); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.doc-name { flex: 1; font-size: 14px; font-weight: 500; }
.doc-meta { font-size: 12px; color: var(--text-muted); }
.doc-status { font-size: 11px; font-weight: 600; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; letter-spacing: 0.03em; }
.doc-status.pending { background: #fef3c7; color: var(--warning); }
.doc-status.processing { background: #dbeafe; color: #1d4ed8; }
.doc-status.completed { background: #d1fae5; color: var(--success); }
.doc-status.failed { background: #fee2e2; color: var(--danger); }

/* Badge tags */
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; letter-spacing: 0.02em; }
.badge-high { background: #d1fae5; color: #065f46; }
.badge-medium { background: #fef3c7; color: #92400e; }
.badge-low { background: #f1f5f9; color: var(--text-muted); }
.badge-privileged { background: #fee2e2; color: #991b1b; }
.badge-sensitive { background: #fce7f3; color: #9d174d; }

/* Review summary panel */
.review-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.review-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.review-stat { background: var(--bg); border-radius: var(--radius); padding: 12px; text-align: center; }
.review-stat-value { font-size: 28px; font-weight: 700; color: var(--primary); line-height: 1; }
.review-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.review-summary { font-size: 14px; line-height: 1.7; color: var(--text); padding: 12px; background: var(--bg); border-radius: var(--radius); }

/* Top evidence cards */
.evidence-list { display: flex; flex-direction: column; gap: 10px; }
.evidence-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.evidence-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.evidence-card-name { font-size: 14px; font-weight: 600; }
.evidence-card-score { font-size: 13px; color: var(--accent); font-weight: 600; }
.evidence-card-topic { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.evidence-card-summary { font-size: 13px; line-height: 1.6; color: var(--text); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-input, .form-textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; font-family: inherit; background: var(--surface); transition: border-color 0.15s; }
.form-input:focus, .form-textarea:focus { outline: none; border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 80px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 480px; box-shadow: 0 20px 40px rgba(0,0,0,0.15); }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; color: var(--primary); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* Drop zone */
.drop-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 32px; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--accent); background: rgba(79,70,229,0.04); }
.drop-zone-icon { font-size: 32px; margin-bottom: 8px; }
.drop-zone-text { font-size: 14px; color: var(--text-muted); }
.drop-zone-text strong { color: var(--accent); }

/* Audit log */
.audit-list { display: flex; flex-direction: column; gap: 6px; }
.audit-item { display: flex; gap: 10px; font-size: 13px; align-items: flex-start; }
.audit-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); margin-top: 6px; flex-shrink: 0; }
.audit-time { color: var(--text-muted); font-size: 12px; min-width: 80px; }
.audit-action { font-weight: 500; }
.audit-detail { color: var(--text-muted); }

/* Spinner */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading state */
.loading-state { text-align: center; padding: 40px; color: var(--text-muted); }
.loading-state .spinner { margin: 0 auto 12px; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state-text { font-size: 14px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 8px 16px; font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Hidden utility */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 600px) {
  .review-stats { grid-template-columns: repeat(3, 1fr); }
  .app-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}