:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --purple: #7c3aed;
  --purple-light: #f5f3ff;
  --neutral-gray: #64748b;
  --neutral-light: #f8fafc;
  
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  padding: 24px 16px;
}

.app-container {
  max-width: 1280px;
  margin: 0 auto;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  background: var(--bg-card);
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: white;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.header-brand h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--neutral-light);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.status-indicator-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-text {
  font-size: 0.85rem;
  font-weight: 600;
}

.cron-badge {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

.admin-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-pill {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #fef3c7;
  color: #92400e;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #fde68a;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4);
  animation: pulse 2s infinite;
}

.pulse-dot.warning {
  background-color: var(--warning);
  box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.4);
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* Sync Banner */
.sync-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-bottom: 20px;
  animation: slideDown 0.3s ease-out;
}

.sync-banner-content {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.sync-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #93c5fd;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.sync-info {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.progress-bar-container {
  flex: 1;
  min-width: 160px;
  height: 8px;
  background: #dbeafe;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: #2563eb;
  transition: width 0.3s ease;
}

.sync-percent {
  font-weight: 700;
  font-size: 0.85rem;
  color: #1e40af;
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.nav-tab {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

.nav-tab.active {
  color: var(--primary);
}

.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}

/* Input Methods Grid */
.input-methods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.input-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-badge {
  position: absolute;
  top: 14px;
  right: 18px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}

.card-icon-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.card-icon-header h3 {
  font-size: 1.12rem;
  font-weight: 700;
}

.input-card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.sheet-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-hint {
  display: block;
  font-size: 0.78rem;
  color: #475569;
  margin-top: 6px;
  background: #f8fafc;
  padding: 6px 10px;
  border-radius: 4px;
  border-left: 3px solid var(--primary);
}

/* Dropzone */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  background: #fafafa;
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--primary);
  background: #f0f7ff;
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-text {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.dropzone-links {
  display: flex;
  justify-content: center;
}

.sample-link {
  font-size: 0.82rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

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

/* File Selected Card */
.file-selected-card {
  margin-top: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  background: #f8fafc;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.file-icon {
  font-size: 1.5rem;
}

.file-details {
  flex: 1;
}

.file-name {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
}

.file-size {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-remove-file {
  background: none;
  border: 1px solid #cbd5e1;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove-file:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

.column-mapping-section h4 {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.mapping-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.mapping-item label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: #334155;
}

.required {
  color: var(--danger);
}

.form-select, .form-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background-color: white;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s;
}

.form-select:focus, .form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.action-bar {
  display: flex;
  justify-content: flex-end;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
  padding: 9px 16px;
  font-size: 0.9rem;
}

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

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

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
  background-color: white;
  color: var(--text-main);
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
}

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

.btn-success:hover {
  background-color: #15803d;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.25);
}

/* Processing State */
.processing-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 48px 24px;
  text-align: center;
  margin-bottom: 24px;
}

.spinner-large {
  width: 44px;
  height: 44px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

/* Results Header */
.results-header-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  background: white;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.results-header-banner h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.results-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.option-badge {
  background: #ede9fe;
  color: var(--purple);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #94a3b8;
}

.stat-card.stat-success::before { background: var(--success); }
.stat-card.stat-danger::before { background: var(--danger); }
.stat-card.stat-warning::before { background: var(--warning); }
.stat-card.stat-neutral::before { background: #64748b; }

.stat-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.stat-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-success .stat-value { color: var(--success); }
.stat-danger .stat-value { color: var(--danger); }
.stat-warning .stat-value { color: var(--warning); }

/* Table Toolbar */
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill-btn {
  background: white;
  border: 1px solid #cbd5e1;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.pill-btn.active {
  background: var(--text-main);
  color: white;
  border-color: var(--text-main);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-input {
  width: 220px;
}

/* Data Table */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  max-height: 650px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.data-table tr:hover {
  background-color: #f8fafc;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-active {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(22, 163, 74, 0.12);
}

.badge-expired {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(185, 28, 28, 0.12);
}

.badge-notfound {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-weight: 700;
}

.badge-primary-cert {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-additional-cert {
  background: #faf5ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}

.badge-cprsr {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #facc15;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(202, 138, 4, 0.15);
}

/* Single Form */
.single-form {
  margin-top: 16px;
  background: #f8fafc;
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  max-width: 650px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.single-result-container {
  margin-top: 20px;
  max-width: 650px;
}

.result-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

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

.result-person-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.result-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.result-field label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.result-field span {
  font-size: 0.9rem;
  font-weight: 600;
}

/* Docs card */
.arch-feature-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 14px 0;
}

.arch-feature-box h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #1e293b;
}

.arch-feature-box p {
  font-size: 0.88rem;
  color: #475569;
}

.code-block-header {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 16px;
  margin-bottom: 6px;
}

.code-block {
  background: #0f172a;
  color: #38bdf8;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
}

.hidden {
  display: none !important;
}
