:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1a1d21;
  --muted: #6b7280;
  --border: #e2e4e8;
  --primary: #2563eb;
  --primary-text: #ffffff;
  --danger: #dc2626;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1e2126;
    --text: #e8eaed;
    --muted: #9aa1ac;
    --border: #30343b;
    --primary: #3b82f6;
    --primary-text: #0b0d10;
    --danger: #f87171;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

nav .spacer { flex: 1; }
nav a { color: var(--text); text-decoration: none; }
nav a:hover { color: var(--primary); }

main {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* Für Seiten, bei denen die Standardbreite zu eng ist (z. B. Audit-Log mit
   langen Detail-Spalten) - VNC-Tools laufen ohnehin meist in großen
   Fenstern, daher hier keine künstliche Begrenzung. */
main.full-width {
  max-width: none;
  margin: 2rem 2.5rem;
}

h1, h2 { font-weight: 600; }

.muted { color: var(--muted); font-size: 0.9em; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

th { color: var(--muted); font-weight: 500; font-size: 0.85em; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }

.btn {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9em;
}

.btn:hover { border-color: var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.icon-btn {
  padding: 0.35rem 0.55rem;
  font-size: 1.05em;
  line-height: 1;
}

.actions-cell {
  display: flex;
  gap: 0.35rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}

.btn-danger { color: var(--danger); border-color: var(--danger); }

.target-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.6rem;
}

.target-info { display: flex; flex-direction: column; gap: 0.15rem; }

.empty { color: var(--muted); font-style: italic; }

dialog {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 1.25rem;
  min-width: 320px;
}

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

form { display: flex; flex-direction: column; gap: 0.6rem; }

form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9em;
}

form label:has(input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

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

input[type="range"] { padding: 0; accent-color: var(--primary); }

output { color: var(--muted); font-variant-numeric: tabular-nums; }

#settings-dialog { min-width: 380px; }

.dialog-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.5rem; }

.error-banner {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

@media (prefers-color-scheme: dark) {
  .error-banner { background: #3f1d1d; color: #fca5a5; border-color: #7f1d1d; }
}

#screen-container {
  width: 100%;
  height: calc(100vh - 4rem);
  background: #000;
}
