:root {
  /* Colors */
  --wf-primary: #3b82f6; /* Blue */
  --wf-primary-dark: #2563eb;
  --wf-secondary: #64748b; /* Neutral Gray */
  --wf-bg: #f8fafc;
  --wf-surface: #ffffff;
  --wf-border: #e2e8f0;
  --wf-text-main: #1e293b;
  --wf-text-muted: #64748b;
  --wf-danger: #ef4444;
  --wf-warning: #f59e0b;
  --wf-success: #10b981;
  
  /* Accents for rows */
  --wf-accent-missing: #fee2e2; /* Light Red */
  --wf-accent-extra: #dbeafe; /* Light Blue */
  --wf-accent-mismatch: #fef3c7; /* Light Yellow */

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--wf-bg);
  color: var(--wf-text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  line-height: 1.5;
}

/* Layout Utilities */
.container {
  max-width: 1400px; /* Wide for diff view */
  margin: 0 auto;
  padding: var(--spacing-lg);
  width: 100%;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

.w-full { width: 100%; }

/* Components */

/* Control Bar */
.control-bar {
  background: var(--wf-surface);
  border: 1px solid var(--wf-border);
  border-radius: 8px;
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.input-group label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--wf-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  padding: 8px 12px;
  border: 1px solid var(--wf-border);
  border-radius: 6px;
  font-size: var(--text-sm);
  min-width: 250px;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--wf-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.form-input.full-width {
  width: 100%;
  min-width: unset;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--wf-primary) 0%, var(--wf-primary-dark) 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
}

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

.btn-secondary:hover {
  background: #475569;
}

/* Search Area */
.search-area {
  margin-bottom: var(--spacing-md);
}

/* Tabs */
.tabs {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--wf-border);
}

.tab {
  padding: var(--spacing-sm) var(--spacing-md);
  font-weight: 600;
  color: var(--wf-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--wf-text-main);
}

.tab.active {
  color: var(--wf-primary);
  border-bottom-color: var(--wf-primary);
}

/* Diff Viewer Layout */
.diff-container {
  background: var(--wf-surface);
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.diff-header {
  display: grid;
  grid-template-columns: 20% 40% 40%;
  background: #f1f5f9;
  border-bottom: 1px solid var(--wf-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.diff-header-cell {
  padding: var(--spacing-md);
  font-weight: 700;
  color: var(--wf-text-main);
  text-transform: uppercase;
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  border-right: 1px solid var(--wf-border);
}
.diff-header-cell:last-child { border-right: none; }

.diff-row {
  display: grid;
  grid-template-columns: 20% 40% 40%;
  border-bottom: 1px solid var(--wf-border);
  transition: background-color 0.1s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  min-height: 80px; /* Consistent height */
}

.diff-row:last-child { border-bottom: none; }
.diff-row:hover { background-color: #f8fafc; }

/* Row Indicators */
.diff-row.missing { border-left: 4px solid var(--wf-danger); background-color: rgba(254, 226, 226, 0.1); }
.diff-row.extra { border-left: 4px solid var(--wf-primary); background-color: rgba(219, 234, 254, 0.1); }
.diff-row.mismatch { border-left: 4px solid var(--wf-warning); background-color: rgba(254, 243, 199, 0.1); }

.diff-cell {
  padding: var(--spacing-md);
  border-right: 1px solid var(--wf-border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.diff-cell:last-child { border-right: none; }

/* Cell Content */
.principal-name {
  font-weight: 700;
  color: var(--wf-text-main);
  display: block;
}
.principal-email {
  font-size: var(--text-sm);
  color: var(--wf-text-muted);
}

.record-name {
  font-weight: 600;
  color: var(--wf-text-main);
  margin-bottom: 4px;
}
.record-details {
  font-size: var(--text-sm);
  color: var(--wf-text-muted);
}
.record-details.error {
  color: var(--wf-danger);
  font-style: italic;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--wf-bg);
  border: 1px solid var(--wf-border);
}

.badge-green { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.badge-yellow { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.badge-red { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* Detail View Styles */
.detail-header {
  border-bottom: 1px solid var(--wf-border);
  padding-bottom: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}
.detail-section {
  background: var(--wf-surface);
  border: 1px solid var(--wf-border);
  border-radius: 8px;
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}
.detail-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--spacing-md);
  color: var(--wf-text-main);
  border-bottom: 1px solid var(--wf-border);
  padding-bottom: var(--spacing-sm);
}
.detail-grid {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: var(--spacing-sm) var(--spacing-lg);
  align-items: baseline;
}
.detail-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--wf-text-muted);
  text-align: right;
}
.detail-value {
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: var(--text-sm);
  color: var(--wf-text-main);
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}

/* Helpers */
.text-xs { font-size: var(--text-xs); }
.text-muted { color: var(--wf-text-muted); }

/* Utility Classes */
.container-narrow { max-width: 900px; }
.m-0 { margin: 0; }
.mt-xs { margin-top: 4px; }
.text-xl { font-size: 1.5rem; }
