:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --border: #2a2e37;
  --text: #e6e8eb;
  --text-dim: #9aa0aa;
  --accent: #4f7cff;
  --accent-hover: #3d65e0;
  --error-bg: #3a1f24;
  --error-text: #ff8a8a;
}

* { box-sizing: border-box; }

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

/* ── Auth pages ─────────────────────────────────────────────────────────── */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.auth-sub {
  margin: 0 0 20px;
  color: var(--text-dim);
  font-size: 14px;
}

.auth-card label {
  display: block;
  font-size: 13px;
  margin: 14px 0 6px;
  color: var(--text-dim);
}

.auth-card input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #11141a;
  color: var(--text);
  font-size: 14px;
}

.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
}

.hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-top: 20px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: transparent;
  color: var(--text);
}

.btn-google {
  background: #fff;
  color: #1f1f1f;
  margin-top: 12px;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  margin: 20px 0 0;
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.divider span { padding: 0 10px; }

.alert {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 8px;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error-text);
}

.auth-footer {
  margin: 20px 0 0;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

.auth-footer a {
  color: var(--accent);
  text-decoration: none;
}

/* ── App shell ──────────────────────────────────────────────────────────── */

.page { min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.brand { font-weight: 700; }

.topbar-nav {
  display: flex;
  gap: 20px;
}

.topbar-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
}

.topbar-nav a:hover,
.topbar-nav a.active {
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-email { color: var(--text-dim); font-size: 14px; }

.inline-form { margin: 0; }

.inline-form .btn { width: auto; margin-top: 0; padding: 8px 14px; }

.content { padding: 32px 24px; }

/* ── Buttons inline with form fields ───────────────────────────────────── */

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.field-wrap {
  position: relative;
}

.field-wrap input {
  padding-right: 72px;
}

.field-icons {
  position: absolute;
  top: 0;
  right: 4px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
}

.icon-btn {
  background: none;
  border: none;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 6px;
}

.icon-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ── Cards / passkey management ────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-top: 24px;
  max-width: 480px;
}

.card h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.card .btn {
  width: auto;
}

.credential-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}

.credential-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

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

/* ── Accounts page ──────────────────────────────────────────────────────── */

.card-wide {
  max-width: 100%;
  overflow-x: auto;
}

.card select,
.card input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #11141a;
  color: var(--text);
  font-size: 14px;
  margin: 0;
}

.card label {
  display: block;
  font-size: 13px;
  margin: 14px 0 6px;
  color: var(--text-dim);
}

.radio-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  margin: 0;
}

.radio-label input {
  width: auto;
}

#follower-mapping {
  border-left: 2px solid var(--border);
  padding-left: 16px;
  margin-top: 10px;
}

.accounts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 8px;
}

.accounts-table th,
.accounts-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.accounts-table th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  background: var(--border);
  color: var(--text-dim);
}

.badge-parent {
  background: var(--accent);
  color: #fff;
}

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

.map-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-form select,
.map-form input {
  width: auto;
  padding: 4px 8px;
  font-size: 12px;
}

.map-form input[type="number"] {
  width: 70px;
}

.btn-link-danger {
  color: var(--error-text);
}
