/* PII Detection Pipeline - Dark Professional Theme */

:root {
    /* Base Colors - Light Mode (Default) */
    --bg-primary: #F9FAFB; /* Gray 50 */
    --bg-secondary: #FFFFFF; /* White */
    --bg-tertiary: #F3F4F6; /* Gray 100 */
    --bg-card: #FFFFFF;
    --bg-hover: #F3F4F6;

    --text-primary: #111827; /* Gray 900 */
    --text-secondary: #4B5563; /* Gray 600 */
    --text-muted: #9CA3AF; /* Gray 400 */

    --accent: #4F46E5; /* Indigo 600 */
    --accent-hover: #4338CA; /* Indigo 700 */
    --accent-light: rgba(79, 70, 229, 0.1);

    --success: #059669; /* Emerald 600 */
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #D97706; /* Amber 600 */
    --warning-bg: rgba(245, 158, 11, 0.1);
    --error: #DC2626; /* Red 600 */
    --error-bg: rgba(239, 68, 68, 0.1);

    --border: #E5E7EB; /* Gray 200 */
    --border-light: #F3F4F6;

    --radius: 8px;
    --radius-lg: 12px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Dark Mode Overrides */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-hover: #334155;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: rgba(59, 130, 246, 0.1);

    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);

    --border: #334155;
    --border-light: #475569;
    
    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
}

/* Header Navigation */
.header-nav {
    display: flex;
    gap: 8px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-tab svg {
    width: 18px;
    height: 18px;
}

.nav-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Project Selector */
.project-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
    margin-left: 24px;
}

.project-dropdown {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 14px;
    min-width: 200px;
    cursor: pointer;
}

.project-dropdown:focus {
    outline: none;
    border-color: var(--accent);
}

.project-dropdown option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Main Layout */
.main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    min-height: calc(100vh - 69px);
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.card-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.card-body {
    padding: 16px;
}

/* Form Elements */
.input-group {
    margin-bottom: 12px;
}

.input-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
}

.input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-block {
    width: 100%;
}

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

.btn svg {
    width: 16px;
    height: 16px;
}

/* Batch List */
.batch-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.batch-item {
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.batch-item:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.batch-item.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

.batch-name {
    font-weight: 500;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.batch-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-created { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-processing, .badge-extracting, .badge-analyzing, .badge-llm_review, .badge-merging, .badge-annotating, .badge-chunking {
    background: var(--warning-bg); color: var(--warning);
}
.badge-completed { background: var(--success-bg); color: var(--success); }
.badge-failed { background: var(--error-bg); color: var(--error); }
.badge-pending { background: var(--bg-tertiary); color: var(--text-muted); }

/* Content Area */
.content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Drop Zone */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.dropzone:hover,
.dropzone.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--text-muted);
}

.dropzone-text {
    font-size: 16px;
    margin-bottom: 8px;
}

.dropzone-hint {
    font-size: 13px;
    color: var(--text-muted);
}

/* File List */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.file-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.file-status {
    font-size: 12px;
    font-weight: 500;
}

.file-status.success { color: var(--success); }
.file-status.pending { color: var(--warning); }
.file-status.error { color: var(--error); }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Progress */
.progress-section {
    padding: 20px;
}

.progress-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    transition: width 0.3s;
}

.progress-text {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* Documents Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-primary);
}

td {
    font-size: 14px;
}

tr:hover td {
    background: var(--bg-hover);
}

.doc-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.findings-count {
    font-weight: 600;
    color: var(--accent);
}

/* Actions */
.actions {
    display: flex;
    gap: 12px;
}

.action-link {
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
}

.action-link:hover {
    text-decoration: underline;
}

/* Person Cards */
.person-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 16px;
}

.person-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.person-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.person-name {
    font-size: 18px;
    font-weight: 600;
}

.person-confidence {
    font-size: 12px;
    color: var(--text-muted);
}

.person-fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.field-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.field-value {
    font-size: 14px;
    color: var(--text-primary);
}

/* Empty State */
.empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    opacity: 0.5;
}

.empty-text {
    font-size: 14px;
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-sm svg {
    margin-right: 4px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-body h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.field-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}

.field-item .label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.field-item .value {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
}

.findings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.finding-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    overflow: hidden;
}

.finding-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 140px;
}

.finding-type {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    white-space: nowrap;
}

.finding-confidence {
    display: none;
}

.finding-value {
    flex: 1;
    font-size: 15px;
    color: var(--text-primary);
    word-break: break-word;
    overflow-wrap: break-word;
    font-family: var(--font-mono);
    line-height: 1.4;
}

.finding-context {
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-word;
    overflow-wrap: break-word;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    border-left: 3px solid var(--border);
}

.finding-details {
    flex: 1;
    min-width: 0;
}

.finding-text {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
    word-break: break-word;
}

.finding-meta {
    font-size: 12px;
    color: var(--text-muted);
}

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

/* Responsive */
@media (max-width: 1024px) {
    .main {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .person-fields {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Persons Database View */
.persons-db-view {
    padding: 24px;
    max-width: 100%;
    min-height: calc(100vh - 69px);
}

.persons-db-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.persons-db-header h2 {
    font-size: 24px;
    font-weight: 600;
}

.persons-count {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 13px;
}

/* Removed - buttons now in .header-actions container */

.persons-db-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: auto;
    overflow-x: scroll;
    max-height: calc(100vh - 180px);
}

/* Always show horizontal scrollbar */
.persons-db-table-container::-webkit-scrollbar {
    height: 12px;
    width: 12px;
}

.persons-db-table-container::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.persons-db-table-container::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 6px;
    border: 2px solid var(--bg-tertiary);
}

.persons-db-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.persons-db-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 1400px;
}

.persons-db-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.persons-db-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 12px 16px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.persons-db-table th.sticky-col {
    position: sticky;
    left: 0;
    z-index: 11;
    background: var(--bg-tertiary);
}

.persons-db-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: top;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.persons-db-table td.sticky-col {
    position: sticky;
    left: 0;
    background: var(--bg-card);
    z-index: 5;
    font-weight: 600;
    white-space: nowrap;
}

.persons-db-table tbody tr:hover td {
    background: var(--bg-hover);
}

.persons-db-table tbody tr.clickable-row {
    cursor: pointer;
}

.persons-db-table tbody tr.clickable-row:hover td {
    background: var(--primary-bg);
}

.persons-db-table tbody tr.clickable-row:hover td.sticky-col,
.persons-db-table tbody tr.clickable-row:hover td.sticky-col-right {
    background: var(--primary-bg);
}

.persons-db-table tbody tr.clickable-row:active td {
    background: rgba(99, 102, 241, 0.15);
}

.persons-db-table tbody tr:hover td.sticky-col {
    background: var(--bg-hover);
}

/* Sticky right column for Source Docs */
.persons-db-table th.sticky-col-right {
    position: sticky;
    right: 0;
    z-index: 11;
    background: var(--bg-tertiary);
    border-left: 2px solid var(--border);
    min-width: 120px;
}

.persons-db-table td.sticky-col-right {
    position: sticky;
    right: 0;
    background: var(--bg-card);
    z-index: 5;
    border-left: 2px solid var(--border);
    min-width: 120px;
}

.persons-db-table tbody tr:hover td.sticky-col-right {
    background: var(--bg-hover);
}

.persons-db-table tbody tr.merged-row td.sticky-col-right {
    background: rgba(99, 102, 241, 0.05);
}

.persons-db-table tbody tr.merged-row:hover td.sticky-col-right {
    background: rgba(99, 102, 241, 0.1);
}

.persons-db-table .cell-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.persons-db-table .cell-list span {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-block;
}

.persons-db-table .cell-muted {
    color: var(--text-muted);
    font-style: italic;
}

.persons-db-table .source-doc {
    font-size: 11px;
    color: var(--text-muted);
}

.persons-db-table .source-doc.clickable {
    color: var(--accent);
    cursor: pointer;
    padding: 2px 6px;
    background: var(--accent-light);
    border-radius: 4px;
    transition: all 0.15s ease;
}

.persons-db-table .source-doc.clickable:hover {
    background: var(--accent);
    color: white;
    text-decoration: none;
}

/* Header Actions (for merge buttons) */
.header-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    z-index: 100;
    position: relative;
}

.header-actions .btn {
    cursor: pointer;
    pointer-events: auto;
}

/* Merge Toggle Button */
#mergeToggleBtn {
    transition: all 0.2s ease;
}

#mergeToggleBtn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Merge Badge */
.merge-badge {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}

/* Merged Row Highlight */
.persons-db-table tbody tr.merged-row td {
    background: rgba(99, 102, 241, 0.05);
}

.persons-db-table tbody tr.merged-row:hover td {
    background: rgba(99, 102, 241, 0.1);
}

.persons-db-table tbody tr.merged-row td.sticky-col {
    background: rgba(99, 102, 241, 0.05);
}

.persons-db-table tbody tr.merged-row:hover td.sticky-col {
    background: rgba(99, 102, 241, 0.1);
}

/* PII Category Flag Columns */
.pii-flag-col {
    text-align: center;
    min-width: 60px;
    max-width: 80px;
    font-size: 11px;
}

.pii-flag-cell {
    text-align: center;
    padding: 4px 6px !important;
}

.pii-flag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.pii-flag-no {
    color: var(--text-muted);
}

.pii-flag-yes {
    color: #fff;
}

.pii-flag-medical {
    background: #dc2626;
}

.pii-flag-criminal {
    background: #b45309;
}

.pii-flag-financial {
    background: #059669;
}

.pii-flag-biometric {
    background: #7c3aed;
}

.pii-flag-government {
    background: #2563eb;
}

/* Document Viewer Modal */
.modal-content-wide {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
}

.modal-content-fullscreen {
    width: calc(100vw - 40px);
    max-width: none;
    height: calc(100vh - 40px);
    max-height: none;
    margin: 20px;
}

.modal-header-viewer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.modal-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.modal-header-left h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.modal-nav-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    padding: 4px 8px;
    border-radius: var(--radius);
}

.btn-nav {
    padding: 6px;
    border-radius: var(--radius-sm);
}

.btn-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.doc-position {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: center;
}

.modal-review-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.review-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.review-quick-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.15s ease;
}

.review-quick-btn svg {
    width: 16px;
    height: 16px;
}

.review-quick-btn:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.review-quick-btn.active {
    color: white;
}

#btnReviewCorrect.active {
    background: var(--success);
    border-color: var(--success);
}

#btnReviewIncorrect.active {
    background: var(--error);
    border-color: var(--error);
}

#btnReviewAttention.active {
    background: var(--warning);
    border-color: var(--warning);
}

.review-clear-btn {
    opacity: 0.6;
}

.review-clear-btn:hover {
    opacity: 1;
    background: var(--bg-tertiary);
}

.current-review-status {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.current-review-status.status-correct {
    background: var(--success-bg);
    color: var(--success);
}

.current-review-status.status-incorrect {
    background: var(--error-bg);
    color: var(--error);
}

.current-review-status.status-needs_attention {
    background: var(--warning-bg);
    color: var(--warning);
}

.modal-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-primary);
    padding: 4px;
    border-radius: var(--radius);
    margin-right: 12px;
}

.modal-tab {
    padding: 6px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.modal-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.modal-tab.active {
    background: var(--accent);
    color: white;
}

.modal-body-viewer {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.doc-preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border);
}

.findings-panel {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    padding: 24px 32px;
}

.findings-panel.hidden {
    display: none;
}

.doc-view-toggle {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.view-toggle-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.view-toggle-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.view-toggle-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.doc-preview-container {
    flex: 1;
    overflow: auto;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-preview-loading {
    text-align: center;
    color: var(--text-muted);
}

.doc-preview-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.doc-preview-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.doc-preview-container iframe,
.doc-preview-container embed,
.doc-preview-container object {
    width: 100%;
    height: 100%;
    border: none;
}

.doc-preview-error {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.doc-preview-error svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.doc-preview-error p {
    margin-bottom: 16px;
}

.doc-preview-unsupported {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.doc-preview-unsupported .file-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.doc-preview-unsupported h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.doc-preview-unsupported p {
    font-size: 13px;
    margin-bottom: 16px;
}

/* PII Types Selection Grid */
.pii-types-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.pii-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-secondary);
    transition: background 0.15s;
}

.pii-checkbox:hover {
    background: var(--bg-hover);
}

.pii-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
}

.pii-checkbox span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 4px;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Batch Item with Delete Button */
.batch-item {
    position: relative;
}

.batch-item .batch-delete {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.batch-item:hover .batch-delete {
    opacity: 1;
}

.batch-item .batch-delete:hover {
    background: var(--error-bg);
    color: var(--error);
}

.batch-item .batch-delete svg {
    width: 14px;
    height: 14px;
}

/* Batch Actions in Header */
.batch-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-icon-sm {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-icon-sm:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon-sm.btn-danger:hover {
    background: var(--error-bg);
    color: var(--error);
    border-color: var(--error);
}

.btn-icon-sm svg {
    width: 16px;
    height: 16px;
}

/* Compact File Upload Summary */
.file-summary {
    margin-top: 12px;
}

.file-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}

.file-summary-bar .summary-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-summary-bar .file-count {
    font-weight: 600;
    color: var(--text-primary);
}

.file-summary-bar .upload-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.file-summary-bar .upload-status.uploading { color: var(--warning); }
.file-summary-bar .upload-status.complete { color: var(--success); }
.file-summary-bar .upload-status.error { color: var(--error); }

.file-summary-bar .toggle-details {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
}

.file-summary-bar .toggle-details:hover {
    background: var(--accent-light);
}

.file-details-list {
    max-height: 120px;
    overflow-y: auto;
    margin-top: 8px;
    display: none;
}

.file-details-list.expanded {
    display: block;
}

.file-details-list .file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
}

.file-details-list .file-row:last-child {
    border-bottom: none;
}

.file-details-list .file-row .file-name {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.file-details-list .file-row .file-name .doc-icon {
    width: 14px;
    height: 14px;
}

.file-details-list .file-row .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.file-details-list .file-row .status-dot.success { background: var(--success); }
.file-details-list .file-row .status-dot.pending { background: var(--warning); }
.file-details-list .file-row .status-dot.error { background: var(--error); }

/* Compact Documents Table */
.table-container.compact table {
    font-size: 12px;
}

.table-container.compact th,
.table-container.compact td {
    padding: 8px 12px;
}

.table-container.compact .doc-name {
    font-size: 12px;
}

.table-container.compact .doc-icon {
    width: 14px;
    height: 14px;
}

.table-container.compact .badge {
    font-size: 10px;
    padding: 2px 6px;
}

/* Sortable Table Headers */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.15s;
}

.sortable:hover {
    background: var(--bg-hover);
}

.sort-icon {
    display: inline-block;
    width: 12px;
    margin-left: 4px;
    opacity: 0.3;
}

.sort-icon::after {
    content: '↕';
    font-size: 10px;
}

.sortable.sort-asc .sort-icon::after {
    content: '↑';
    opacity: 1;
}

.sortable.sort-desc .sort-icon::after {
    content: '↓';
    opacity: 1;
}

.sortable.sort-asc .sort-icon,
.sortable.sort-desc .sort-icon {
    opacity: 1;
    color: var(--accent);
}

/* Blanks First Indicator */
.sortable.sort-blanks .sort-icon::after {
    content: '∅↑';
}

.sortable.sort-blanks-desc .sort-icon::after {
    content: '∅↓';
}

/* Small spinner for upload status */
.spinner-small {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--border);
    border-top-color: var(--warning);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}

/* ==================== Project Landing Page ==================== */

.project-landing {
    min-height: 100vh;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
}

.landing-header {
    padding: 20px 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.landing-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 48px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.landing-intro {
    text-align: center;
    margin-bottom: 32px;
}

.landing-intro h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.landing-intro p {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 500px;
    line-height: 1.6;
}

/* Project Cards Grid */
.project-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    width: 100%;
    margin-bottom: 24px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.project-card:hover::before {
    opacity: 1;
}

.project-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.project-card-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.project-card-icon svg {
    width: 24px;
    height: 24px;
}

.project-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.project-card:hover .project-card-actions {
    opacity: 1;
}

.project-card-actions button {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.project-card-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.project-card-actions button.delete-btn:hover {
    background: var(--error-bg);
    color: var(--error);
}

.project-card-actions button svg {
    width: 16px;
    height: 16px;
}

.project-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.project-card-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 42px;
}

.project-card-stats {
    display: flex;
    gap: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.project-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.project-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

.project-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-card-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
    display: flex;
    align-items: flex-end;
}

/* Create Project Card */
.create-project-card {
    background: transparent;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 320px;
}

.create-project-card:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.create-project-icon {
    width: 56px;
    height: 56px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.create-project-card:hover .create-project-icon {
    background: var(--accent);
    color: white;
}

.create-project-icon svg {
    width: 28px;
    height: 28px;
}

.create-project-card span {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.create-project-card:hover span {
    color: var(--text-primary);
}

/* Empty Projects State */
.projects-empty {
    text-align: center;
    padding: 48px 24px;
    width: 100%;
}

.projects-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    color: var(--text-muted);
    opacity: 0.5;
}

.projects-empty h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.projects-empty p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Active Project Display in Header */
.active-project-display {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: auto;
    margin-left: 24px;
}

.back-to-projects-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.back-to-projects-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

.back-to-projects-btn svg {
    width: 18px;
    height: 18px;
}

.project-name-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.logo.clickable {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.logo.clickable:hover {
    opacity: 0.8;
}

/* Hide old project selector */
.project-selector {
    display: none;
}

/* Responsive adjustments for landing page */
@media (max-width: 768px) {
    .landing-content {
        padding: 40px 20px;
    }

    .landing-intro h1 {
        font-size: 24px;
    }

    .project-cards-grid {
        grid-template-columns: 1fr;
    }

    .create-project-card {
        min-width: auto;
    }
}

/* ==================== Project Dashboard ==================== */

.dashboard-header {
    text-align: center;
    margin-bottom: 16px;
}

.dashboard-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 16px 0 8px;
}

.dashboard-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

.back-btn svg {
    width: 16px;
    height: 16px;
}

.dashboard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
}

.dashboard-loading .spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 16px;
}

.dashboard-error {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.dashboard-error a {
    color: var(--accent);
}

.dashboard-container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

/* Summary Cards */
.dashboard-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow);
}

.summary-card.primary {
    background: linear-gradient(135deg, var(--accent) 0%, #1d4ed8 100%);
    border-color: transparent;
}

.summary-card.primary .summary-icon {
    background: rgba(255,255,255,0.2);
    color: white;
}

.summary-card.primary .summary-value,
.summary-card.primary .summary-label {
    color: white;
}

.summary-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.summary-icon svg {
    width: 24px;
    height: 24px;
}

.summary-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.summary-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.summary-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.dashboard-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.dashboard-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.dashboard-section .no-data {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 24px 16px;
}

/* Processing Status Section */
.processing-status-section {
    margin-bottom: 24px;
}

.processing-bar-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.processing-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.processing-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.processing-percentage {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    min-width: 40px;
}

.processing-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.processing-stats .stat-item {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.processing-stats .stat-item::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.processing-stats .stat-item.completed::before {
    background: var(--success);
}

.processing-stats .stat-item.processing::before {
    background: var(--warning);
}

.processing-stats .stat-item.pending::before {
    background: var(--text-muted);
}

.processing-stats .stat-item.failed::before {
    background: var(--error);
}

/* Region Chart */
.region-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.region-bar-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.region-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.region-name {
    color: var(--text-primary);
    font-weight: 500;
}

.region-count {
    color: var(--text-muted);
}

.region-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.region-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.region-bar-fill[data-region="UK"] { background: #3b82f6; }
.region-bar-fill[data-region="EU"] { background: #8b5cf6; }
.region-bar-fill[data-region="US"] { background: #ef4444; }
.region-bar-fill[data-region="AMERICAS"] { background: #f97316; }
.region-bar-fill[data-region="APAC"] { background: #10b981; }
.region-bar-fill[data-region="MENA"] { background: #f59e0b; }
.region-bar-fill[data-region="AFRICA"] { background: #06b6d4; }
.region-bar-fill[data-region="EUROPE_OTHER"] { background: #6366f1; }
.region-bar-fill[data-region="UNKNOWN"] { background: var(--text-muted); }

/* Nationality List */
.nationality-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nationality-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    gap: 12px;
}

.nationality-rank {
    width: 24px;
    height: 24px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.nationality-name {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.nationality-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* PII Types Grid */
.pii-types-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pii-type-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
}

.pii-type-name {
    color: var(--text-primary);
}

.pii-type-count {
    background: var(--accent);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

/* Confidence Chart */
.confidence-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.confidence-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--radius);
}

.confidence-item.high {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid var(--success);
}

.confidence-item.medium {
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid var(--warning);
}

.confidence-item.low {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--error);
}

.confidence-label {
    font-size: 13px;
    color: var(--text-primary);
}

.confidence-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Dashboard Actions */
.dashboard-actions {
    display: flex;
    justify-content: center;
    padding-top: 16px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-lg svg {
    width: 20px;
    height: 20px;
}

/* Dashboard Responsive */
@media (max-width: 1400px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .dashboard-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .dashboard-summary {
        grid-template-columns: 1fr;
    }

    .summary-card {
        padding: 16px;
    }

    .summary-value {
        font-size: 24px;
    }
}

/* Theme Toggle Button */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* ==================== Documents Review View ==================== */
.documents-view {
    padding: 24px;
    height: calc(100vh - 64px);
    overflow: auto;
}

.documents-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.documents-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.documents-filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius);
}

.documents-filter-tabs .filter-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: all 0.15s ease;
}

.documents-filter-tabs .filter-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.documents-filter-tabs .filter-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.documents-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-left: auto;
}

.stat-separator {
    color: var(--border);
}

.documents-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: auto;
}

.documents-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.documents-table th,
.documents-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.documents-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.documents-table tbody tr:hover {
    background: var(--bg-hover);
}

.documents-table .doc-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.documents-table .doc-name.clickable {
    cursor: pointer;
    color: var(--accent);
}

.documents-table .doc-name.clickable:hover {
    text-decoration: underline;
}

.batch-name {
    color: var(--text-muted);
    font-size: 12px;
}

.doc-type-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

.findings-link {
    color: var(--accent);
    text-decoration: none;
}

.findings-link:hover {
    text-decoration: underline;
}

.no-findings {
    color: var(--text-muted);
}

/* Review Status Badges */
.review-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.review-status-badge:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

.badge-not_reviewed {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-correct {
    background: var(--success-bg);
    color: var(--success);
}

.badge-incorrect {
    background: var(--error-bg);
    color: var(--error);
}

.badge-needs_attention {
    background: var(--warning-bg);
    color: var(--warning);
}

.review-notes-icon {
    margin-left: 6px;
    cursor: help;
}

/* Review Popover */
.review-popover {
    position: fixed;
    z-index: 1000;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 320px;
}

.review-popover.hidden {
    display: none;
}

.review-popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
}

.review-popover-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.review-popover-close:hover {
    color: var(--text-primary);
}

.review-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
}

.review-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.review-btn:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.review-btn.selected {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.review-btn.review-correct:hover,
.review-btn.review-correct.selected {
    border-color: var(--success);
    background: var(--success);
    color: white;
}

.review-btn.review-incorrect:hover,
.review-btn.review-incorrect.selected {
    border-color: var(--error);
    background: var(--error);
    color: white;
}

.review-btn.review-attention:hover,
.review-btn.review-attention.selected {
    border-color: var(--warning);
    background: var(--warning);
    color: white;
}

.review-notes-section {
    padding: 0 16px 16px;
}

.review-notes-section label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.review-notes-section textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

.review-notes-section textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.review-popover-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

