/* Admin — User Management.
   Deliberately self-contained: this portal shares no stylesheet with the VPN
   console so the two can be deployed, restyled or split apart independently. */

:root {
  --bg: #0f1216;
  --panel: #161a21;
  --panel-2: #1c212a;
  --line: #262c37;
  --text: #e8ebf0;
  --dim: #8a93a2;
  --accent: #4c8dff;
  --accent-soft: #1e2a3f;
  --ok: #3ecf8e;
  --warn: #f0b429;
  --danger: #f05252;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

.hidden { display: none !important; }
.spacer { flex: 1; }
.dim { color: var(--dim); }
.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 12px; }
.right { text-align: right; }

/* ------------------------------------------------------------- sign in */

.signin-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.signin {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
}

.signin h1 { margin: 0 0 4px; font-size: 20px; }
.signin .sub { color: var(--dim); margin: 0 0 24px; font-size: 13px; }

/* --------------------------------------------------------------- shell */

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 58px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.top h1 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: .2px; }

.badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #2c4573;
  white-space: nowrap;
}
.badge.warn { background: #3a2f14; color: var(--warn); border-color: #5b4a1f; }
.badge.ok { background: #14301f; color: var(--ok); border-color: #1f5238; }
.badge.off { background: #2a2f38; color: var(--dim); border-color: var(--line); }
.badge.danger { background: #3a1d1d; color: var(--danger); border-color: #5e2a2a; }

.layout { display: flex; align-items: flex-start; }

nav.side {
  width: 210px;
  flex: 0 0 210px;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  min-height: calc(100vh - 58px);
  position: sticky;
  top: 58px;
}

nav.side button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--dim);
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  margin-bottom: 2px;
}
nav.side button:hover { background: var(--panel-2); color: var(--text); }
nav.side button.on { background: var(--accent-soft); color: #cfe0ff; }

nav.side .group {
  font-size: 10.5px;
  letter-spacing: 1.2px;
  color: #5d6675;
  padding: 14px 12px 6px;
  font-weight: 700;
}

main { flex: 1; padding: 22px 26px 60px; min-width: 0; }

.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.head p { margin: 2px 0 0; color: var(--dim); font-size: 13px; }

/* --------------------------------------------------------------- cards */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 120px;
}
.stat .n { font-size: 24px; font-weight: 600; }
.stat .l { color: var(--dim); font-size: 12px; margin-top: 2px; }

/* --------------------------------------------------------------- table */

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .8px;
  color: var(--dim);
  font-weight: 600;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 11px 10px; border-bottom: 1px solid #1f242d; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #191e26; }

.who-cell { display: flex; flex-direction: column; gap: 2px; }
.who-cell .nm { font-weight: 500; }
.who-cell .em { color: var(--dim); font-size: 12px; }

.empty { padding: 40px 10px; text-align: center; color: var(--dim); }

/* -------------------------------------------------------------- inputs */

label.f { display: block; margin-bottom: 12px; }
label.f span { display: block; font-size: 12px; color: var(--dim); margin-bottom: 5px; }

input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
select { cursor: pointer; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=text] { max-width: 280px; }
.toolbar select { max-width: 200px; }

/* ------------------------------------------------------------- buttons */

button.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
button.btn:hover { background: #3f7ce6; }
button.btn:disabled { background: #33445f; color: #7d8899; cursor: default; }

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}
button.ghost:hover { background: var(--panel-2); }
button.ghost.sm { padding: 5px 10px; font-size: 12.5px; }
button.ghost.danger { color: var(--danger); border-color: #4a2626; }
button.ghost.danger:hover { background: #2a1a1a; }

.actions { display: flex; gap: 6px; justify-content: flex-end; }

/* --------------------------------------------------------------- modal */

.modal-back {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .6);
  display: grid; place-items: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 100%; max-width: 520px;
  max-height: 88vh; overflow: auto;
  padding: 24px;
}
.modal.wide { max-width: 780px; }
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .sub { color: var(--dim); font-size: 13px; margin: 0 0 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ------------------------------------------------------- permissions */

.perm-group { margin-bottom: 18px; }
.perm-group h4 {
  margin: 0 0 8px; font-size: 11px; letter-spacing: 1px; color: var(--dim);
}
.perm {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 7px 10px; border-radius: 7px;
}
.perm:hover { background: var(--panel-2); }
.perm input { margin-top: 3px; accent-color: var(--accent); }
.perm .t { font-size: 13.5px; }
.perm .d { font-size: 12px; color: var(--dim); }

/* -------------------------------------------------------------- alerts */

.alert {
  padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px;
  border: 1px solid;
}
.alert.err { background: #2b1a1a; border-color: #5e2a2a; color: #ffb4b4; }
.alert.ok { background: #14261e; border-color: #1f5238; color: #a5e8c8; }

.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--dim); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff; color: #1f2328; border: none; border-radius: 8px;
  padding: 10px; font: inherit; font-weight: 500; cursor: pointer;
}
.google:hover { background: #f1f3f5; }

@media (max-width: 820px) {
  nav.side { width: 64px; flex: 0 0 64px; }
  nav.side .label, nav.side .group { display: none; }
  main { padding: 16px; }
}
