:root {
  --bg: #0f1115;
  --panel: #171a21;
  --border: #2a2f3a;
  --text: #e6e8ee;
  --muted: #8b93a3;
  --accent: #4f8cff;
  --ok: #2ea043;
  --bad: #d1242f;
  --warn: #b7791f;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.error { color: var(--bad); }

.nav {
  display: flex; gap: 18px; align-items: center;
  padding: 12px 20px; background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.nav .brand { font-weight: 700; color: var(--text); }
.nav .right { margin-left: auto; }

.wrap { max-width: 900px; margin: 0 auto; padding: 24px 20px 60px; }

h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 24px 0 10px; }
h3 { font-size: 15px; margin: 14px 0 6px; }

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px; margin: 18px 0;
}
.card.ok { border-left: 4px solid var(--ok); }
.card.bad { border-left: 4px solid var(--bad); }
.login { max-width: 360px; margin: 60px auto; }

table { width: 100%; border-collapse: collapse; margin: 10px 0; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
table.kv th { width: 160px; }

form label { display: block; margin: 10px 0; }
form label.inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; }
input, select {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  background: #0d0f14; border: 1px solid var(--border); border-radius: 6px;
  color: var(--text);
}
label.inline input { width: auto; margin-top: 0; }

button {
  margin-top: 10px; padding: 8px 16px; border: 0; border-radius: 6px;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}
button.warn { background: var(--warn); }
button.link { background: none; color: var(--accent); padding: 0; margin: 0; font-weight: 400; }
button:hover { filter: brightness(1.1); }

.row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin: 14px 0; }
.row form { margin: 0; }

.stats { display: flex; gap: 16px; margin: 16px 0; }
.stat {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 20px;
}
.stat .num { font-size: 28px; font-weight: 700; display: block; }

.badge {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 20px;
  background: var(--border); color: var(--text); vertical-align: middle;
}
.badge.warn { background: var(--warn); color: #fff; }
.kvpair { display: inline-block; margin-right: 10px; color: var(--muted); font-size: 13px; }
code { background: #0d0f14; padding: 2px 6px; border-radius: 4px; }

/* Server access matrix */
.legend { margin: 4px 0 14px; }
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 20px;
  font-size: 12px; border: 1px solid var(--border);
}
.matrix-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table.matrix { width: auto; min-width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; }
table.matrix th, table.matrix td { border-bottom: 1px solid var(--border); white-space: nowrap; }
table.matrix th.emp { text-align: center; min-width: 92px; }
table.matrix th.emp small { color: var(--muted); font-weight: 400; }
table.matrix td.cell { text-align: center; padding: 6px; }
table.matrix .sticky {
  position: sticky; left: 0; z-index: 1; background: var(--panel);
  border-right: 1px solid var(--border);
}
table.matrix thead th { background: var(--panel); }
table.matrix form { margin: 0; }
table.matrix select { width: auto; margin: 0; padding: 5px 8px; font-weight: 600; }

/* Level colours (used on both pills and the cell dropdowns) */
.lvl-off  { color: var(--muted); border-color: var(--border); }
.lvl-ok   { color: #7ee2a8; border-color: var(--ok); }
.lvl-sudo { color: #f0c674; border-color: var(--warn); }
select.lvl-off  { background: #14171d; }
select.lvl-ok   { background: #12251a; }
select.lvl-sudo { background: #2a2213; }

/* Confirmed access (Check access) — dark green cell */
table.matrix td.access-ok { background: #0b3d1e; }
table.matrix td.cell.access-ok select { background: rgba(0, 0, 0, 0.25); border-color: #2ea043; }
.pill.access-ok { background: #0b3d1e; color: #7ee2a8; border-color: #2ea043; }

/* No root password — dark red cell */
table.matrix td.access-bad { background: #4a0f14; }
.pill.access-bad { background: #4a0f14; color: #ffb3ba; border-color: var(--bad); }

/* Other-users column (rightmost) */
table.matrix th.others-col, table.matrix td.others-col {
  min-width: 160px; max-width: 260px; white-space: normal; text-align: left;
}
.others-found { color: #ffb3ba; font-weight: 600; }

/* Employees grid: inline rotate button */
table.grid td form { margin: 0; }
table.grid td button { margin: 0; padding: 6px 12px; font-size: 13px; }
table.grid code { white-space: nowrap; }
code.pw-new { background: #12251a; outline: 1px solid var(--ok); color: #7ee2a8; }
table.grid .editform { display: flex; gap: 8px; align-items: center; margin: 0; }
table.grid .editform input[name="notes"] { width: 150px; margin: 0; padding: 6px 8px; }
table.grid .inline-form { display: inline; margin: 0; }
table.grid .inline-form + .inline-form { margin-left: 6px; }
.inline-form { display: inline-block; margin: 0 0 0 10px; }
.inline-form button { margin: 0; padding: 6px 12px; font-size: 13px; }
.notice {
  background: #12251a; border: 1px solid var(--ok); border-radius: 8px;
  padding: 10px 14px; margin: 12px 0;
}
