:root {
  --bg: #0a0a0a;
  --surface: #101010;
  --line: #232323;
  --line-strong: #333333;
  --text: #ffffff;
  --muted: #8b8b8b;
  --mint: #8ef8d2;
  --danger: #ff5f5f;
  --font: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--mint); color: #08120e; }

.hidden { display: none !important; }

/* ---------- brand ---------- */

.brand {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}

.brand-lg { font-size: 15px; letter-spacing: 0.24em; }

.brand-sep { color: var(--mint); margin: 0 0.15em; }

/* ---------- screens ---------- */

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#boot .boot-line {
  position: relative;
  width: 140px;
  height: 2px;
  background: var(--line);
  overflow: hidden;
}

#boot .boot-line::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  background: var(--mint);
  animation: sweep 1.1s ease-in-out infinite;
}

@keyframes sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.login-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 28px;
  padding: 44px 36px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: center;
}

.denied-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.denied-text {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.16em;
  color: var(--mint);
}

.denied-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
}

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

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.08em;
  line-height: 1.2;
  padding: 10px 18px;
  border-radius: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s, opacity 0.15s;
}

.btn:hover:not(:disabled) { border-color: var(--mint); color: var(--mint); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn:focus-visible { outline: 1px solid var(--mint); outline-offset: 2px; }

.btn-primary {
  background: var(--mint);
  border-color: var(--mint);
  color: #08120e;
  font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
  background: #a8ffdf;
  border-color: #a8ffdf;
  color: #08120e;
}

.btn-danger { color: var(--danger); border-color: #3a2020; }

.btn-danger:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-ghost { border-color: transparent; color: var(--muted); }

.btn-ghost:hover:not(:disabled) {
  border-color: transparent;
  color: var(--mint);
  background: transparent;
}

.btn-small { padding: 6px 12px; font-size: 12px; }
.btn-wide { width: 100%; padding: 13px 18px; }

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

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.account {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.account-name {
  max-width: 42vw;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- tabs ---------- */

.tabs {
  position: sticky;
  top: 60px;
  z-index: 4;
  display: flex;
  gap: 4px;
  padding: 0 24px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.tab {
  appearance: none;
  padding: 15px 18px;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.06em;
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--mint);
  border-bottom-color: var(--mint);
}

/* ---------- content / forms ---------- */

.content {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}

.panel-title {
  margin: 0 0 24px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.12em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field-grow { flex: 1 1 auto; }

.label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
}

input[type="text"] {
  appearance: none;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: #0d0d0d;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s;
}

input[type="text"]:focus { border-color: var(--mint); }
input[type="text"]::placeholder { color: #555555; }
input[type="text"]:disabled { opacity: 0.55; cursor: not-allowed; }

.row-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 10px;
}

.lookup-form {
  display: flex;
  gap: 14px;
  align-items: end;
  margin-bottom: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 24px;
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.color-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.swatch {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  background: transparent;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  font-size: 13px;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--mint);
}

.check input:disabled { opacity: 0.55; cursor: not-allowed; }

.actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
}

.flags-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.staff-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 10px;
}

.staff-form .perm-field { grid-column: 1 / -1; }

.perm-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.perm {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}

.perm input {
  width: 15px;
  height: 15px;
  accent-color: var(--mint);
  cursor: pointer;
}

.staff-table { min-width: 820px; }
.staff-table th,
.staff-table td {
  white-space: nowrap;
  word-break: normal;
  vertical-align: middle;
}
.staff-table .col-actions { width: 150px; }
.staff-table .cell-actions { width: 150px; }
.staff-table .perm-checks {
  flex-direction: column;
  gap: 4px;
}

.perm-cell { min-width: 180px; }

.row-check {
  width: 16px;
  height: 16px;
  accent-color: var(--mint);
  cursor: pointer;
}

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

.toggles {
  display: flex;
  gap: 12px;
}

.toggle {
  appearance: none;
  padding: 12px 30px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.toggle:hover:not(:disabled) { border-color: var(--mint); color: var(--mint); }
.toggle:focus-visible { outline: 1px solid var(--mint); outline-offset: 2px; }
.toggle:disabled { opacity: 0.45; cursor: not-allowed; }

.toggle[aria-pressed="true"] {
  background: var(--mint);
  border-color: var(--mint);
  color: #08120e;
  font-weight: 700;
}

/* ---------- status ---------- */

.status {
  margin: 10px 0 0;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.status.ok { color: var(--mint); }
.status.err { color: var(--danger); }

.hint {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 12px;
}

.muted {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: #333333 #0a0a0a;
}

.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-track { background: #0a0a0a; }
.table-wrap::-webkit-scrollbar-thumb { background: #2c2c2c; }

.table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
}

.table th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-align: left;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid #171717;
  font-size: 13px;
  word-break: break-all;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #0d0d0d; }

.mono { font-family: var(--mono); font-size: 12px; }

.col-actions { width: 80px; }

.cell-actions {
  width: 80px;
  text-align: right;
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .staff-form { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .staff-form { grid-template-columns: 1fr; }
  .topbar {
    position: static;
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
    row-gap: 10px;
  }
  .topbar .brand { font-size: 11px; letter-spacing: 0.16em; }
  .account { margin-left: auto; gap: 10px; }
  .account-name { max-width: 58vw; }
  .tabs { top: 0; padding: 0 12px; }
  .content { padding: 24px 16px 48px; }
  .row-form { grid-template-columns: 1fr; align-items: stretch; }
  .form-grid { grid-template-columns: 1fr; }
  .lookup-form { flex-direction: column; align-items: stretch; }
  .toggles { flex-wrap: wrap; }
}
