:root {
  --bg: #f8f9fa;
  --card-bg: #ffffff;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text-muted: #666;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --gray-bg: #f3f4f6;
  --red: #dc2626;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ── Auth View ── */

.auth-container {
  max-width: 400px;
  margin: 120px auto;
  text-align: center;
}

.auth-container h1 {
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
}

.auth-form {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: left;
}

.auth-form h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.auth-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.auth-form button {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 12px;
}

.auth-form button:hover {
  background: var(--accent-hover);
}

.switch-link {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.switch-link a {
  color: var(--accent);
  text-decoration: none;
}

/* ── Dashboard ── */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px 0;
}

header h1 {
  font-size: 1.5rem;
}

main {
  max-width: 800px;
  margin: 24px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 60px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

/* API Key */

.api-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-key-row code {
  flex: 1;
  padding: 8px 12px;
  background: var(--gray-bg);
  border-radius: 6px;
  font-size: 0.9rem;
  word-break: break-all;
}

/* Buttons */

button {
  cursor: pointer;
}

.btn-outline {
  padding: 6px 16px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.btn-outline:hover {
  background: var(--gray-bg);
}

.btn-small {
  padding: 6px 12px;
  background: var(--gray-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text);
}

.btn-small:hover {
  background: var(--border);
}

/* Add connector form */

.add-connector-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-connector-form select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  min-width: 160px;
}

#dynamic-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dynamic-field {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  width: 100%;
}

.add-connector-form button {
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  align-self: flex-start;
}

.add-connector-form button:hover {
  background: var(--accent-hover);
}

.auth-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--gray-bg);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Connectors list */

.empty-state {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 12px 0;
}

.connector-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.connector-item:last-child {
  border-bottom: none;
}

.connector-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connector-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-active {
  background: var(--green-bg);
  color: var(--green);
}

.status-pending {
  background: var(--gray-bg);
  color: var(--text-muted);
}

.btn-connect {
  padding: 6px 14px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
}

.btn-connect:hover {
  background: #15803d;
}

/* Steps */

.steps {
  padding-left: 20px;
}

.steps li {
  margin-bottom: 12px;
}

.steps li strong {
  display: block;
}

.steps li span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.steps code {
  background: var(--gray-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Security */

.security-list {
  list-style: none;
}

.security-list li {
  padding: 8px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.security-list li:last-child {
  border-bottom: none;
}

/* Error */

.error {
  color: var(--red);
  font-size: 0.9rem;
  margin-top: 8px;
}

/* Responsive */

@media (max-width: 600px) {
  .auth-container {
    margin: 60px 16px;
  }

  .add-connector-form select {
    min-width: auto;
  }

  .connector-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
