:root {
  --bg: #0f1115;
  --bg-panel: #171a21;
  --border: #2a2f3a;
  --text: #e6e8ec;
  --text-dim: #9aa1ad;
  --accent: #4f8cff;
  --ok: #3ecf8e;
  --err: #ef5a5a;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); }

nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

nav .brand {
  font-weight: 600;
  margin-right: 16px;
}

nav a.navlink {
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
}

nav a.navlink:hover, nav a.navlink.active {
  background: #1f2430;
  color: var(--text);
}

nav .spacer { flex: 1; }

nav .userinfo {
  color: var(--text-dim);
  font-size: 0.9em;
  margin-right: 12px;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}

h1 { font-size: 1.4em; }
h2 { font-size: 1.1em; margin-top: 0; }

button, input, select {
  font-family: inherit;
  font-size: 0.95em;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
}

button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.secondary {
  background: #262b36;
  color: var(--text);
}

button.danger {
  background: var(--err);
}

input[type="text"], input[type="password"], input[type="number"], input[type="datetime-local"], input[type="time"], select {
  background: #10131a;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 10px;
  width: 100%;
}

label {
  display: block;
  font-size: 0.85em;
  color: var(--text-dim);
  margin-bottom: 4px;
  margin-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92em;
}

th { color: var(--text-dim); font-weight: 500; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78em;
  font-weight: 600;
}

.badge.ok { background: rgba(62,207,142,0.15); color: var(--ok); }
.badge.err { background: rgba(239,90,90,0.15); color: var(--err); }
.badge.running { background: rgba(79,140,255,0.15); color: var(--accent); }
.badge.idle { background: #262b36; color: var(--text-dim); }

.error-message {
  color: var(--err);
  font-size: 0.9em;
  margin-top: 8px;
}

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1; }

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: inline-block;
  vertical-align: middle;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.gallery-grid figure {
  margin: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.gallery-grid img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  background: #000;
}

.gallery-grid figcaption {
  padding: 8px 10px;
  font-size: 0.8em;
  color: var(--text-dim);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  width: 340px;
}

.hidden { display: none !important; }
.text-dim { color: var(--text-dim); }
.mt-0 { margin-top: 0; }
