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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  line-height: 1.5;
}

/* Header */
header {
  background: #1a73e8;
  color: white;
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#userInfo {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* Navigation */
nav {
  background: white;
  padding: 0 2rem;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  gap: 0;
}

.nav-btn {
  background: none;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  color: #666;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.nav-btn:hover {
  color: #1a73e8;
  background: #f8f9fa;
}

.nav-btn.active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
  font-weight: 500;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Login */
.login-card {
  max-width: 400px;
  margin: 4rem auto;
  background: white;
  padding: 3rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  text-align: center;
}

.login-card h2 {
  margin-bottom: 1rem;
  color: #1a73e8;
}

.login-card p {
  margin-bottom: 2rem;
  color: #666;
}

/* Buttons */
.btn {
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.btn-primary {
  background: #1a73e8;
  color: white;
}

.btn-primary:hover {
  background: #1557b0;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #b02a37;
}

.btn-outline {
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,0.6);
}

.btn-outline:hover {
  background: rgba(255,255,255,0.1);
}

.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
}

/* View Header */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.view-header h2 {
  font-size: 1.5rem;
  color: #333;
}

/* Tables */
.data-table {
  width: 100%;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

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

.data-table th {
  background: #f8f9fa;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #666;
  border-bottom: 1px solid #e0e0e0;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.875rem;
}

.data-table tr:last-child td {
  border-bottom: none;
}

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

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-pending { background: #fff3cd; color: #856404; }
.badge-running { background: #cce5ff; color: #004085; }
.badge-success { background: #d4edda; color: #155724; }
.badge-partial { background: #fff3cd; color: #856404; }
.badge-error { background: #f8d7da; color: #721c24; }
.badge-paused { background: #e2e3e5; color: #383d41; }
.badge-admin { background: #e8daef; color: #6c3483; }
.badge-user { background: #d6eaf8; color: #21618c; }

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
}

/* Forms */
form {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #333;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.875rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.form-actions .btn-outline {
  color: #666;
  border-color: #ddd;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  color: white;
  font-size: 0.875rem;
  animation: slideIn 0.3s ease;
  max-width: 350px;
}

.toast-success { background: #28a745; }
.toast-error { background: #dc3545; }
.toast-info { background: #17a2b8; }

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

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: #999;
}

.empty-state p {
  font-size: 1rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: #666;
}

/* Responsive */
@media (max-width: 768px) {
  .container { padding: 1rem; }
  header { padding: 0.75rem 1rem; }
  nav { padding: 0 1rem; }
  .view-header { flex-direction: column; gap: 1rem; align-items: flex-start; }
  .data-table { overflow-x: auto; }
}

/* Instructions */
.instructions-card {
  background: white;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.instructions-list {
  padding-left: 1.5rem;
}

.instructions-list li {
  margin-bottom: 1rem;
  line-height: 1.7;
  font-size: 0.95rem;
}

.instructions-list li:last-child {
  margin-bottom: 0;
}

/* History filters */
.history-filters {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.history-filters .checkbox-label {
  font-size: 0.875rem;
  color: #555;
}

/* Purge confirmation modal */
.modal-header-warning h3 {
  color: #dc3545;
}

.purge-modal-body {
  padding: 1.5rem;
}

.purge-warning {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.purge-email-hint {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.purge-mismatch {
  color: #dc3545;
  font-size: 0.8rem;
  margin-top: 0.4rem;
}

#purgeEmailInput {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.875rem;
}

#purgeEmailInput:focus {
  outline: none;
  border-color: #dc3545;
  box-shadow: 0 0 0 2px rgba(220,53,69,0.15);
}

/* Log modal */
.modal-content-lg {
  max-width: 800px;
  width: 95%;
  height: 80vh;
  display: flex;
  flex-direction: column;
}

.log-container {
  flex: 1;
  overflow-y: auto;
  background: #1e1e1e;
  padding: 1rem;
  border-radius: 0 0 8px 8px;
}

#logContent {
  color: #d4d4d4;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}

/* Migration cards */
.migration-card {
  background: white;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border-left: 4px solid #e0e0e0;
}

.migration-card:has(.migration-dot.running) {
  border-left-color: #1a73e8;
}

.migration-card:has(.migration-dot.paused) {
  border-left-color: #ffc107;
}

.migration-card:has(.migration-dot.success) {
  border-left-color: #28a745;
}

.migration-card:has(.migration-dot.error) {
  border-left-color: #dc3545;
}

.migration-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

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

.migration-email {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

.migration-meta {
  font-size: 0.8rem;
  color: #666;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.migration-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.migration-dot.running { background: #1a73e8; animation: pulse 1.5s infinite; }
.migration-dot.paused { background: #ffc107; }
.migration-dot.success { background: #28a745; }
.migration-dot.error { background: #dc3545; }
.migration-dot.pending { background: #999; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.migration-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.75rem;
  color: #555;
  padding-top: 0.3rem;
}

.migration-stats span {
  white-space: nowrap;
}

.migration-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-icon {
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: #f0f0f0;
}

/* Stat icons */
.stat-icon {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin-right: 2px;
}

/* Scrollable table container */
.scrollable-table {
  max-height: 60vh;
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* Search input */
.search-input {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.875rem;
  width: 220px;
}

.search-input:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}
