@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a2035;
  --bg-card-hover: #1e2642;
  --bg-glass: rgba(26, 32, 53, 0.85);
  --border: rgba(99, 115, 155, 0.2);
  --border-active: rgba(99, 179, 255, 0.4);
  --text-primary: #e8eaf0;
  --text-secondary: #8b95b0;
  --text-muted: #5a6580;
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.3);
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
  --gradient-primary: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --gradient-success: linear-gradient(135deg, #10b981, #06b6d4);
  --gradient-warning: linear-gradient(135deg, #f59e0b, #ef4444);
  --gradient-danger: linear-gradient(135deg, #ef4444, #ec4899);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ============ LAYOUT ============ */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: var(--transition);
  backdrop-filter: blur(20px);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

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

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-glow);
}

.sidebar-logo h1 {
  font-size: 16px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}

.sidebar-logo .subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  position: relative;
}

.nav-item:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent-blue);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-blue);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* Main Content */
.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 24px 32px;
  min-height: 100vh;
}

.site-record-footer {
  margin-left: 260px;
  padding: 0 32px 22px;
  margin-top: -8px;
  position: relative;
  z-index: 1;
  text-align: center;
}

.site-record-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(99, 115, 155, 0.22);
  background: rgba(17, 24, 39, 0.65);
  color: var(--text-secondary);
  font-size: 12px;
  text-decoration: none;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.site-record-link::before {
  content: '\eb1c';
  font-family: 'remixicon';
  font-size: 14px;
}

.site-record-link:hover {
  color: var(--accent-blue);
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.08);
}

.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.3), transparent);
  opacity: 0;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-active);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  border-color: var(--border-active);
  box-shadow: var(--shadow-glow);
  transform: translateY(-3px);
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}

.stat-card .stat-icon.blue { background: rgba(59, 130, 246, 0.15); }
.stat-card .stat-icon.green { background: rgba(16, 185, 129, 0.15); }
.stat-card .stat-icon.yellow { background: rgba(245, 158, 11, 0.15); }
.stat-card .stat-icon.red { background: rgba(239, 68, 68, 0.15); }
.stat-card .stat-icon.purple { background: rgba(139, 92, 246, 0.15); }
.stat-card .stat-icon.cyan { background: rgba(6, 182, 212, 0.15); }

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-card .stat-change {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.stat-change.up { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.stat-change.down { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--gradient-success);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
  transform: translateY(-1px);
}

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

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

.btn-outline:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.08);
}

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

.btn-lg {
  padding: 14px 28px;
  font-size: 15px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============ FORMS ============ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

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

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

/* ============ TABLE ============ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.data-table {
  width: 100%;
  min-width: max-content;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(99, 115, 155, 0.1);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.05);
}

.data-table tbody tr.suspicious {
  background: rgba(239, 68, 68, 0.05);
  border-left: 3px solid var(--accent-red);
}

.data-table tbody tr.suspicious:hover {
  background: rgba(239, 68, 68, 0.1);
}

.pairings-table-shell {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.pairings-layout {
  width: 100%;
  min-width: 0;
}

.pairings-pool-card {
  width: 100%;
  min-width: 0;
}

.pairings-suspects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 14px;
  max-height: 240px;
  overflow-y: auto;
}

.suspect-grid-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition);
}

.suspect-grid-item:hover {
  border-color: var(--border-active);
  background: rgba(59, 130, 246, 0.08);
}

.suspect-grid-item.active {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.15);
}

.pairings-main-card {
  min-width: 0;
  overflow: hidden;
}

.pairings-table-shell .table-container {
  display: block;
  width: max-content;
  min-width: 100%;
  max-width: none;
}

.pairings-table-shell .data-table {
  width: max-content;
  min-width: 100%;
}

/* ============ BADGE ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.badge-blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.badge-green { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.badge-yellow { background: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); }
.badge-red { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.badge-cyan { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }

.badge-ghost {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-tile {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

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

.summary-tile .value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.summary-tile .hint {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.case-toolbar,
.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition);
}

.filter-chip:hover {
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

.filter-chip.active {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.4);
  color: #dbeafe;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.guide-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  padding: 14px 16px;
}

.guide-card .step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.16);
  color: var(--accent-blue);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

.guide-card h4 {
  font-size: 14px;
  margin-bottom: 6px;
}

.guide-card p {
  font-size: 12px;
  color: var(--text-secondary);
}

.detail-panel {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(8, 15, 30, 0.55);
  padding: 16px;
}

.detail-panel h4 {
  font-size: 14px;
  margin-bottom: 10px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.detail-grid > * {
  min-width: 0;
}

.detail-item {
  border: 1px solid rgba(99, 115, 155, 0.14);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.025);
  min-width: 0;
}

.detail-item .label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.detail-item .value {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.list-card {
  border: 1px solid rgba(99, 115, 155, 0.14);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
}

.list-card + .list-card {
  margin-top: 10px;
}

.list-card .title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.list-card .meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.insight-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.insight-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.12);
  background: rgba(59, 130, 246, 0.06);
  font-size: 12px;
  color: #dbeafe;
}

.split-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-top: 24px;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rule-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(99, 115, 155, 0.14);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
}

.rule-item + .rule-item {
  margin-top: 10px;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.risk-badge.high {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.14);
}

.risk-badge.medium {
  color: var(--accent-yellow);
  background: rgba(245, 158, 11, 0.16);
}

.risk-badge.low {
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.14);
}

.type-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.type-chip.payment {
  color: #14b8a6;
  background: rgba(20, 184, 166, 0.14);
}

.type-chip.pimp {
  color: #f97316;
  background: rgba(249, 115, 22, 0.14);
}

.type-chip.keyboard {
  color: #facc15;
  background: rgba(250, 204, 21, 0.14);
}

.dossier-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.7fr);
  gap: 20px;
}

.dossier-main,
.dossier-side {
  min-width: 0;
}

.dossier-section {
  margin-top: 18px;
  border: 1px solid rgba(99, 115, 155, 0.14);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  min-width: 0;
  overflow: hidden;
}

.dossier-section h4 {
  font-size: 14px;
  margin-bottom: 12px;
}

.review-panel {
  position: sticky;
  top: 16px;
  border: 1px solid rgba(99, 115, 155, 0.14);
  border-radius: var(--radius-md);
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.review-panel h4 {
  font-size: 15px;
  margin-bottom: 14px;
}

.timeline-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.timeline-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid rgba(99, 115, 155, 0.12);
  min-width: 0;
}

.timeline-row:last-child {
  border-bottom: none;
}

.timeline-row .time {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.timeline-row .content {
  min-width: 0;
  overflow: hidden;
}

.timeline-row .content .title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.timeline-row .content .meta {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.address-cluster {
  border: 1px solid rgba(99, 115, 155, 0.14);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
}

.address-cluster + .address-cluster {
  margin-top: 12px;
}

.address-cluster .title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}

.address-cluster .meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.6;
  word-break: break-word;
}

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

.inline-detail-row td {
  padding: 0 !important;
  border-bottom: none;
  background: rgba(4, 10, 24, 0.55);
}

.inline-detail-panel {
  margin-top: 0;
  border: none;
  border-top: 1px solid rgba(99, 115, 155, 0.18);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(11, 18, 35, 0.96), rgba(8, 15, 30, 0.92));
  padding: 18px;
}

.inline-direction-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.inline-direction-tag.income {
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.14);
}

.inline-direction-tag.expense {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.14);
}

.match-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.match-badge.high {
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.match-badge.medium {
  background: rgba(245, 158, 11, 0.16);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.24);
}

.match-badge.low {
  background: rgba(59, 130, 246, 0.14);
  color: #bfdbfe;
  border: 1px solid rgba(96, 165, 250, 0.22);
}

.compact-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.mini-stat {
  padding: 14px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.5);
}

.mini-stat .k {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.mini-stat .v {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.evidence-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.evidence-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.evidence-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-secondary);
}

.evidence-pill.account {
  background: rgba(34, 197, 94, 0.14);
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.22);
}

.evidence-pill.identity {
  background: rgba(59, 130, 246, 0.14);
  color: #bfdbfe;
  border-color: rgba(59, 130, 246, 0.24);
}

.evidence-pill.phone {
  background: rgba(6, 182, 212, 0.14);
  color: #a5f3fc;
  border-color: rgba(6, 182, 212, 0.24);
}

.evidence-pill.address {
  background: rgba(245, 158, 11, 0.14);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.24);
}

.evidence-pill.payer {
  background: rgba(168, 85, 247, 0.14);
  color: #e9d5ff;
  border-color: rgba(168, 85, 247, 0.24);
}

.evidence-pill.time {
  background: rgba(99, 102, 241, 0.14);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.24);
}

.evidence-pill.pimp {
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.24);
}

.evidence-pill.keyboard {
  background: rgba(217, 119, 6, 0.16);
  color: #fde68a;
  border-color: rgba(217, 119, 6, 0.24);
}

.detail-item-highlight {
  border-left: 3px solid rgba(248, 113, 113, 0.7);
  padding-left: 12px;
}

.mini-stat.accent-red {
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.16);
}

.mini-stat.accent-blue {
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.16);
}

.mini-stat.accent-cyan {
  box-shadow: inset 0 0 0 1px rgba(6, 182, 212, 0.16);
}

.mini-stat.accent-purple {
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.16);
}

.mini-stat.accent-green {
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.16);
}

.mini-stat.accent-amber {
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.16);
}

.profile-section {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(8, 15, 30, 0.45);
}

.profile-section-danger {
  border-color: rgba(248, 113, 113, 0.2);
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.12), rgba(8, 15, 30, 0.42));
}

.profile-section-info {
  border-color: rgba(56, 189, 248, 0.2);
  background: linear-gradient(180deg, rgba(8, 47, 73, 0.12), rgba(8, 15, 30, 0.42));
}

.profile-section-neutral {
  border-color: rgba(99, 102, 241, 0.16);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.18), rgba(8, 15, 30, 0.42));
}

.profile-detail-panel .list-card .title,
.profile-detail-panel .detail-item div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-detail-panel .detail-item-highlight div {
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
  line-height: 1.7;
}

.btn-outline-active {
  color: var(--accent-cyan);
  border-color: rgba(34, 211, 238, 0.28);
  background: rgba(34, 211, 238, 0.08);
}

@media (max-width: 1100px) {
  .split-layout,
  .dossier-grid {
    grid-template-columns: 1fr;
  }

  .review-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .timeline-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* ============ UPLOAD AREA ============ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(59, 130, 246, 0.02);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.1);
}

.upload-zone .upload-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.upload-zone h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.upload-zone p {
  color: var(--text-muted);
  font-size: 13px;
}

/* ============ PROGRESS ============ */
.progress-bar {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ============ STEP INDICATOR ============ */
.steps-container {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: var(--transition);
}

.step-item.active {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.08);
}

.step-item.done {
  border-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.08);
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.step-item.active .step-dot {
  background: var(--accent-blue);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
  animation: pulse 2s infinite;
}

.step-item.done .step-dot {
  background: var(--accent-green);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 90%;
  max-width: 500px;
  transform: scale(0.9) translateY(20px);
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ============ PAGINATION ============ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination button {
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  font-size: 13px;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.pagination button.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: white;
}

.pagination .page-info {
  color: var(--text-muted);
  font-size: 13px;
}

/* ============ CHARTS ============ */
.chart-container {
  width: 100%;
  min-height: 400px;
  position: relative;
}

#sankey-chart-wrapper:fullscreen {
  background: #0b1220;
  padding: 24px;
  overflow: auto;
  box-sizing: border-box;
}

#sankey-chart-wrapper:fullscreen #sankey-chart {
  min-height: 100%;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.chart-full {
  grid-column: span 2;
}

/* ============ GRID LAYOUTS ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-2 > * { min-width: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* ============ LOADING ============ */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  border-radius: inherit;
  z-index: 10;
}

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

/* ============ TOAST ============ */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  animation: slideIn 0.3s ease;
  min-width: 300px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent-blue); }

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

/* ============ FILTER BAR ============ */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.filter-bar .form-input,
.filter-bar .form-select {
  width: auto;
  min-width: 150px;
  padding: 8px 12px;
  font-size: 13px;
}

.filter-bar .search-input {
  flex: 1;
  min-width: 200px;
}

/* ============ ANALYSIS FLOW ============ */
.analysis-pipeline {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 32px;
  overflow-x: auto;
  padding: 4px;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 120px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.pipeline-step:hover {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.05);
}

.pipeline-step.completed {
  border-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.05);
}

.pipeline-step.running {
  border-color: var(--accent-yellow);
  background: rgba(245, 158, 11, 0.05);
}

.pipeline-step .step-number {
  width: 28px;
  height: 28px;
  background: var(--bg-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.pipeline-step.completed .step-number {
  background: var(--accent-green);
  color: white;
}

.pipeline-step.running .step-number {
  background: var(--accent-yellow);
  color: var(--bg-primary);
}

.pipeline-step .step-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pipeline-arrow {
  font-size: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state .empty-icon {
  font-size: 64px;
  opacity: 0.3;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

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

/* ============ CASE CARDS ============ */
.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.case-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.case-card:hover {
  border-color: var(--border-active);
  box-shadow: var(--shadow-glow);
  transform: translateY(-3px);
}

.case-card .case-status {
  position: absolute;
  top: 16px;
  right: 16px;
}

.case-card .case-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-card .case-desc {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.case-card .case-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.case-card .case-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
  .chart-row { grid-template-columns: 1fr; }
  .chart-full { grid-column: span 1; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; }
  .site-record-footer { margin-left: 0; padding: 0 16px 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ============ AMOUNT COLORS ============ */
.amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.amount.income { color: var(--accent-green); }
.amount.expense { color: var(--accent-red); }

/* ============ RELATIONSHIP TAGS ============ */
.tag-client { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.tag-suspect { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.tag-pimp { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.tag-keyboard { background: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); padding: 2px 8px; border-radius: 4px; font-size: 11px; }

/* ============ SIDEBAR USER PANEL ============ */
.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.15);
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
}

.role-admin { color: var(--accent-red); }
.role-user { color: var(--accent-blue); }
.role-viewer { color: var(--accent-cyan); }

.user-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition);
}

.btn-icon:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.08);
}
