:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --text: #e7ecf3;
  --muted: #9aa7b8;
  --accent: #3d8bfd;
  --danger: #e35d6a;
  --ok: #3cb371;
  --border: #2a3648;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar nav a { margin-left: 1rem; color: var(--text); }
.brand { font-weight: 700; color: var(--text); }
.container { max-width: 1100px; margin: 1.5rem auto; padding: 0 1rem; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
h1, h2, h3 { margin-top: 0; }
.flash {
  background: #243247;
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.flash-error { border-color: var(--danger); color: #ffc9cf; }
label { display: block; margin: 0.75rem 0 0.25rem; color: var(--muted); font-size: 0.9rem; }
input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #121925;
  color: var(--text);
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
button, .btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn-secondary { background: #40506a; }
.btn-danger { background: var(--danger); }
.btn-ok { background: var(--ok); }
.tree ul { list-style: none; padding-left: 1.25rem; }
.tree > ul { padding-left: 0; }
.tree li { margin: 0.4rem 0; }
.node {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  background: #121925;
}
.node.deleted { opacity: 0.55; }
.tree-client > .node { cursor: pointer; }
.tree-toggle {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
}
.tree-toggle::before { content: "▶"; }
.tree-client.is-expanded > .node .tree-toggle::before { content: "▼"; }
.tree-client:not(.is-expanded) > .tree-children { display: none; }
.tree-label {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}
.tree-actions {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #2d3b52;
  color: var(--muted);
}
.muted { color: var(--muted); }
.checkbox-inline { display: flex; align-items: center; gap: 0.5rem; margin: 1rem 0; }
.checkbox-inline input { width: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.55rem; border-bottom: 1px solid var(--border); }
@media (max-width: 720px) {
  .row { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .topbar nav a { margin-left: 0; margin-right: 0.75rem; }
}
