:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1a1f2e;
  --muted: #5c6578;
  --border: #d8dee8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #059669;
  --error: #dc2626;
  --warning: #d97706;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; }
.topbar nav a {
  margin-left: 1rem;
  color: var(--muted);
  text-decoration: none;
}
.topbar nav a.active, .topbar nav a:hover { color: var(--primary); }

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

h1 { margin-top: 0; }
h2 { margin: 1.5rem 0 1rem; font-size: 1.1rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.warning { color: var(--warning); font-size: 0.875rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}
.card.narrow { max-width: 420px; margin: 3rem auto; }
.link-card { text-decoration: none; color: inherit; display: block; }
.link-card:hover { border-color: var(--primary); }

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

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.card-header h3 { margin: 0; font-size: 1rem; }

.badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--border);
  text-transform: capitalize;
}
.badge.running { background: #d1fae5; color: var(--success); }
.badge.stopped { background: #fee2e2; color: var(--error); }
.badge.partial { background: #fef3c7; color: var(--warning); }

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

.btn {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  font-size: 0.875rem;
}
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.btn.primary:hover { background: var(--primary-hover); }
.btn.small { padding: 0.25rem 0.6rem; }

.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.stack label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.875rem; }
.stack input[type="text"],
.stack input[type="password"] {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}
.checkbox { flex-direction: row !important; align-items: center; gap: 0.5rem !important; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}
.alert.success { background: #d1fae5; color: #065f46; }
.alert.error { background: #fee2e2; color: #991b1b; }

.log {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.8rem;
  max-height: 480px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.table th, .table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th { background: var(--bg); font-size: 0.875rem; }

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--primary);
  text-decoration: none;
}
code {
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.875em;
}

.row { margin-bottom: 1rem; }
select {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 240px;
}
