:root {
  --bg: #14161c;
  --bg-elevated: #1c1f28;
  --border: #2a2e3a;
  --text: #e6e8ee;
  --muted: #8b90a0;
  --primary: #4f8cff;
  --primary-hover: #3d76e0;
  --danger: #e0554f;
  --success: #4caf6a;
  --warn: #d9a441;
  --radius: 10px;
}

* { 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);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); }

a { color: var(--primary); }

h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }

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

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.login-card {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

input, select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 0.95rem;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
}

.btn {
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
}

.btn.primary { background: var(--primary); color: white; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.subtle { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.subtle:hover { background: var(--bg); }
.btn.danger { background: var(--danger); color: white; }
.btn.small { padding: 6px 10px; font-size: 0.8rem; }

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

.topbar-right { display: flex; align-items: center; gap: 12px; }

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

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

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

.instance-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.instance-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.instance-name { font-weight: 600; font-size: 1.05rem; }
.instance-game { font-size: 0.8rem; color: var(--muted); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-badge.running .status-dot { background: var(--success); }
.status-badge.stopped .status-dot { background: var(--muted); }
.status-badge.unbekannt .status-dot { background: var(--warn); }

.instance-meta { font-size: 0.82rem; color: var(--muted); }

.instance-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal { width: 420px; max-width: 92vw; max-height: 88vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal.wide { width: 640px; }

.modal-header { display: flex; justify-content: space-between; align-items: center; }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.dynamic-fields { display: flex; flex-direction: column; gap: 10px; }

.logs-box {
  background: #0b0c10;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  max-height: 50vh;
  overflow-y: auto;
}

.checkbox-row { flex-direction: row; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
