:root {
  --primary: #1877f2;
  --primary-dark: #145cb3;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #1c1e21;
  --muted: #65676b;
  --border: #dadde1;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #ca8a04;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.navbar {
  background: var(--primary);
  color: #fff;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.navbar .brand { font-weight: 700; font-size: 1.2rem; }
.navbar .user { display: flex; align-items: center; gap: 1rem; font-size: 0.9rem; }

.container {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.card {
  background: var(--card);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

h1, h2, h3 { margin: 0 0 0.75rem; }
p { margin: 0 0 1rem; }

.form-group { margin-bottom: 1rem; }
label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--muted); }
input, textarea, select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}
textarea { min-height: 90px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-secondary { background: #e4e6eb; color: var(--text); }

.actions { display: flex; gap: 0.5rem; margin-top: 1rem; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge.active { background: #dcfce7; color: var(--success); }
.badge.inactive { background: #f3f4f6; color: var(--muted); }
.badge.paused { background: #fef9c3; color: var(--warning); }
.badge.error { background: #fee2e2; color: var(--danger); }
.badge.pending { background: #f3f4f6; color: var(--muted); }
.badge.running { background: #dbeafe; color: var(--primary); }
.badge.completed { background: #dcfce7; color: var(--success); }
.badge.failed { background: #fee2e2; color: var(--danger); }
.badge.cancelled { background: #f3e8ff; color: #7c3aed; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }

.bot-card { cursor: pointer; transition: transform 0.1s, box-shadow 0.1s; }
.bot-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.bot-card h3 { display: flex; justify-content: space-between; align-items: center; }

.detail-header { display: flex; justify-content: space-between; align-items: flex-start; }
.detail-header .meta { color: var(--muted); font-size: 0.9rem; }

.tabs { display: flex; gap: 0.5rem; border-bottom: 1px solid var(--border); margin: 1rem 0; }
.tab {
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.list-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
  background: #fff;
}
.list-item h4 { margin: 0 0 0.3rem; }
.list-item p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.empty { color: var(--muted); font-style: italic; }

.login-card { max-width: 360px; margin: 8rem auto; text-align: center; }
.login-card h1 { margin-bottom: 0.25rem; }
.login-card p { color: var(--muted); }

.error { color: var(--danger); font-size: 0.9rem; }

.hidden { display: none; }

.row { display: flex; gap: 1rem; }
.row > * { flex: 1; }

.job-status-select { width: auto; }
