* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
}

/* Header / Config Bar */
header {
  background: #1a1a2e;
  color: #fff;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

header h1 {
  font-size: 18px;
  margin-bottom: 12px;
  color: #00b4d8;
}

.config-fields {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.config-fields .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.config-fields label {
  font-size: 11px;
  text-transform: uppercase;
  color: #8d99ae;
  letter-spacing: 0.5px;
}

.config-fields input {
  background: #16213e;
  border: 1px solid #2d3a5c;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  width: 260px;
}

.config-fields input:focus {
  outline: none;
  border-color: #00b4d8;
}

.config-fields button {
  background: none;
  border: none;
  color: #8d99ae;
  cursor: pointer;
  font-size: 14px;
  padding: 8px 4px;
}

.btn-save {
  background: #00b4d8 !important;
  color: #fff !important;
  border: none !important;
  padding: 8px 20px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  font-weight: 600;
  font-size: 13px !important;
}

.btn-save:hover { background: #0096c7 !important; }

#config-status {
  font-size: 12px;
  color: #4ade80;
}

/* Main */
main {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 40px;
}

/* Cards */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h2 {
  font-size: 16px;
  margin-bottom: 4px;
  color: #1a1a2e;
}

.hint {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 16px;
}

/* Forms */
.form-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

input, select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  color: #1a1a2e;
}

input:focus, select:focus {
  outline: none;
  border-color: #00b4d8;
  box-shadow: 0 0 0 3px rgba(0,180,216,0.1);
}

/* Buttons */
.btn-primary {
  background: #00b4d8;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

.btn-primary:hover { background: #0096c7; }
.btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }

.btn-secondary {
  background: #e5e7eb;
  color: #374151;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
}

.btn-secondary:hover { background: #d1d5db; }

.btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.btn-danger:hover { background: #dc2626; }

/* Results */
.result {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: 'SF Mono', Monaco, monospace;
  line-height: 1.5;
}

.result.success {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  color: #065f46;
}

.result.error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.result.info {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e40af;
}

.result.verified {
  background: #ecfdf5;
  border: 2px solid #4ade80;
}

.result.not-verified {
  background: #fef2f2;
  border: 2px solid #f87171;
}

.hidden { display: none !important; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 13px;
}

th {
  background: #f9fafb;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  color: #4b5563;
}

tr:hover td { background: #f9fafb; }

.empty {
  text-align: center;
  color: #9ca3af;
  padding: 24px;
  font-size: 14px;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-approved { background: #d1fae5; color: #065f46; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-webhook { background: #dbeafe; color: #1e40af; }
.badge-polling { background: #f3e8ff; color: #6b21a8; }

/* API key display */
.api-key-display {
  background: #fef3c7;
  border: 2px solid #f59e0b;
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
}

.api-key-display code {
  display: block;
  background: #1a1a2e;
  color: #4ade80;
  padding: 12px;
  border-radius: 6px;
  margin: 8px 0;
  font-size: 13px;
  word-break: break-all;
  user-select: all;
}

.api-key-display .warning {
  color: #92400e;
  font-weight: 600;
  font-size: 13px;
}

/* Loading */
#loading {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: #00b4d8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Match reasons */
.match-reasons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.match-tag {
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
