:root {
  --bg: #0f1420;
  --panel: #171e2e;
  --panel-2: #1e2740;
  --text: #e6ebf5;
  --muted: #8b94a8;
  --accent: #4f8cff;
  --ok: #2fbf71;
  --warn: #e6a23c;
  --error: #e05252;
  --border: #283252;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, "Segoe UI", sans-serif;
}
code { color: #a8c7ff; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 2rem 0 .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.muted { color: var(--muted); }

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .75rem 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.1rem; }
.brand span, .login-card h1 span { color: var(--accent); }
.topbar nav { display: flex; gap: 1rem; flex: 1; }
.topbar nav a { color: var(--text); opacity: .8; }
.topbar nav a:hover { opacity: 1; text-decoration: none; }

.page { max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem; }
.page.bare { display: flex; justify-content: center; padding-top: 12vh; }

.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash-success { background: rgba(47,191,113,.12); border: 1px solid var(--ok); }
.flash-error { background: rgba(224,82,82,.12); border: 1px solid var(--error); }

.stat-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.5rem; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: .75rem 1.25rem; min-width: 130px; }
.stat-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 1.3rem; font-weight: 600; }
.stat-value small { color: var(--muted); font-size: .8rem; font-weight: 400; }

.node-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: .75rem; }
.node-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.node-meta { display: flex; flex-wrap: wrap; gap: 1.25rem; color: var(--muted); font-size: .9rem; margin-top: .5rem; }
.node-meta b { color: var(--text); font-weight: 600; }

.bar { height: 10px; background: var(--panel-2); border-radius: 5px; overflow: hidden; }
.bar.big { height: 18px; border-radius: 9px; margin: 1.5rem 0 .75rem; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #7db0ff); transition: width .4s; }

.badge { font-size: .75rem; padding: .15rem .55rem; border-radius: 20px; font-weight: 600; }
.badge-ok { background: rgba(47,191,113,.15); color: var(--ok); }
.badge-warn { background: rgba(230,162,60,.15); color: var(--warn); }
.badge-error { background: rgba(224,82,82,.15); color: var(--error); }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: .6rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: none; }

label { display: block; margin-bottom: .75rem; color: var(--muted); font-size: .9rem; }
input[type=text], input[type=password], input[type=url] {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem .75rem;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font-size: .95rem;
}
input:focus { outline: none; border-color: var(--accent); }
.form-grid { max-width: 480px; }

.filter-row { display: flex; gap: .75rem; align-items: flex-end; margin-bottom: 1.25rem; }
.filter-row label { flex: 1; margin-bottom: 0; }
.filter-row button, .filter-row .btn { white-space: nowrap; }

.action-group { display: flex; gap: .5rem; flex-wrap: wrap; }
.pin-info { font-size: .75rem; }

.pager { display: flex; justify-content: space-between; margin-top: 1rem; }

.data-preview { max-width: 480px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }

button, .btn {
  display: inline-block; padding: .5rem 1rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font-size: .9rem;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.danger { background: transparent; border-color: var(--error); color: var(--error); }
button.danger:hover { background: rgba(224,82,82,.12); }
.logout button { font-size: .85rem; }

.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 2rem 2.5rem; width: 360px; }
.login-card h1 { margin-bottom: .25rem; }
.login-card button { width: 100%; margin-top: .5rem; }

.key-once { display: inline-block; margin-top: .5rem; padding: .4rem .6rem; background: var(--panel-2); border-radius: 6px; user-select: all; }
pre { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: .75rem 1rem; overflow-x: auto; }
