:root {
  color-scheme: light dark;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273449;
  --border: #334155;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --accent: #3b82f6;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

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

header.topbar .brand { font-weight: 700; font-size: 1.1rem; }
header.topbar nav a {
  color: var(--text-dim);
  text-decoration: none;
  margin-left: 18px;
  font-size: 0.9rem;
}
header.topbar nav a:hover, header.topbar nav a.active { color: var(--text); }

main { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }

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

.grid { display: grid; gap: 16px; }
.grid.apps { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.app-tile {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  transition: border-color 0.15s, transform 0.15s;
}
.app-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.app-tile h3 { margin: 0 0 6px; }
.app-tile p { margin: 0; color: var(--text-dim); font-size: 0.85rem; }

.stat-tile h4 { margin: 0 0 6px; color: var(--text-dim); font-size: 0.8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-tile .value { font-size: 1.6rem; font-weight: 700; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge.online { background: rgba(34,197,94,.15); color: var(--ok); }
.badge.stopped, .badge.errored { background: rgba(239,68,68,.15); color: var(--err); }
.badge.warn { background: rgba(245,158,11,.15); color: var(--warn); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }

button, input, select {
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
}
button { cursor: pointer; background: var(--accent); border-color: var(--accent); color: white; font-weight: 600; }
button.secondary { background: var(--surface-2); color: var(--text); }
button.danger { background: var(--err); border-color: var(--err); }

.error-msg { color: var(--err); font-size: 0.9rem; min-height: 1.2em; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 320px; }
.login-card h1 { font-size: 1.2rem; margin-top: 0; }
.field { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 0.85rem; color: var(--text-dim); }
.field input { width: 100%; }

pre.log { max-height: 320px; overflow: auto; background: #0b1220; padding: 12px; border-radius: 8px; font-size: 0.8rem; }

dialog { border: none; padding: 0; background: transparent; }
dialog::backdrop { background: rgba(0,0,0,0.6); }
dialog .card { margin: 0; }
.checkbox-list { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow: auto; }
.checkbox-list label { display: flex; align-items: center; gap: 8px; font-weight: normal; font-size: 0.9rem; }
