:root {
  --bg: #0d1220;
  --surface: #141b2d;
  --surface-2: #1b2540;
  --border: #26314d;
  --text: #e8ecf5;
  --muted: #93a0bd;
  --primary: #3b82f6;
  --primary-2: #60a5fa;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
  --r: 12px;
}

* { box-sizing: border-box; }

/* Muss die klassenbasierten display-Regeln (.login/.modal-root) schlagen,
   sonst bleibt das Overlay/der Login trotz [hidden] sichtbar. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(59,130,246,0.14), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(13,18,32,0.7);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.brand span { color: var(--muted); font-weight: 600; }

.top-actions { display: flex; gap: 8px; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 24px 80px; }

.muted { color: var(--muted); }
.hint { font-size: 12px; }

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

.login {
  max-width: 420px;
  margin: 8vh auto 0;
  display: grid;
  gap: 12px;
}
.login h2 { margin: 0; }
.login p { margin: 0; }

.input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.input:focus { border-color: var(--primary); }
textarea.input { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; font-family: ui-monospace, monospace; }

.btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn.block { width: 100%; }
.btn.xs { height: 30px; padding: 0 10px; font-size: 12px; }

.err {
  color: #fecaca;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.4);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
}

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

.empty { padding: 40px; text-align: center; border: 1px dashed var(--border); border-radius: var(--r); }

.tbl {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.tbl th, .tbl td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: top;
}
.tbl th { background: var(--surface-2); color: var(--muted); font-weight: 700; }
.tbl tr:last-child td { border-bottom: none; }
.tbl td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.cellLabel { font-weight: 700; }
.cellSub { color: var(--muted); font-size: 11px; margin-top: 2px; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
}
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.off { color: var(--warn); border-color: var(--warn); }

.rowActions { display: flex; flex-wrap: wrap; gap: 6px; }

.modal-root {
  position: fixed;
  inset: 0;
  background: rgba(4,8,18,0.6);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
}
.modal h3 { margin: 0 0 4px; }
.modal .sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.secretBox {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  word-break: break-all;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  margin-bottom: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 40;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--danger); }

@media (max-width: 720px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border-bottom: 1px solid var(--border); }
  .tbl td { border-bottom: none; padding: 6px 14px; }
}
