:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --border: #2d3f56;
  --text: #e8eef7;
  --muted: #8ba3c0;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
  font-family: "Segoe UI", system-ui, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 360px;
}

.login-card h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.subtitle { color: var(--muted); margin-bottom: 1.5rem; font-size: 0.9rem; }

.login-card input {
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
}

.login-card button {
  width: 100%;
  padding: 0.7rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.error { color: var(--danger); font-size: 0.85rem; margin-top: 0.5rem; }

#app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
}

.brand { font-weight: 700; margin-bottom: 1.5rem; color: var(--accent); }

.nav-link {
  display: block;
  padding: 0.55rem 0.75rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 0.25rem;
  font-size: 0.92rem;
}

.nav-link:hover, .nav-link.active {
  background: var(--surface2);
  color: var(--text);
}

.logout {
  margin-top: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
}

.content { flex: 1; padding: 1.25rem 1.5rem; overflow: auto; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.job-indicator {
  background: var(--surface2);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.stat-card .label { color: var(--muted); font-size: 0.8rem; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; margin-top: 0.25rem; }

.toolbar { margin-bottom: 1rem; }

.btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}

.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; margin-right: 0.25rem; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; background: var(--surface2); }
tr:hover td { background: rgba(59, 130, 246, 0.05); }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.online { background: rgba(34,197,94,0.15); color: var(--success); }
.badge.offline { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge.unconfigured { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge.queued, .badge.running { background: rgba(59,130,246,0.15); color: var(--accent); }
.badge.completed { background: rgba(34,197,94,0.15); color: var(--success); }
.badge.failed, .badge.error { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge.unknown { background: rgba(139,163,192,0.15); color: var(--muted); }

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 1.5rem;
  min-width: 420px;
  max-width: 90vw;
}

dialog::backdrop { background: rgba(0,0,0,0.6); }

dialog label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

dialog input, dialog select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
}

.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }
.hint { color: var(--muted); font-size: 0.85rem; margin-bottom: 1rem; }

h3 { margin-bottom: 1rem; font-size: 1rem; color: var(--muted); }
