:root {
  --bg: #0b0b0c;
  --surface: #18191c;
  --surface-2: #222328;
  --line: #303137;
  --text: #f7f7f8;
  --muted: #999ba3;
  --green: #67e858;
  --green-dark: #173b1b;
  --red: #ff5b66;
  --yellow: #f5d76e;
  --radius: 22px;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 300;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: radial-gradient(circle at 50% 0%, #20221f 0, transparent 32rem), var(--bg);
}

button, input, a { font: inherit; }
form { margin: 0; }

.topbar {
  height: 72px;
  max-width: 1180px;
  margin: auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.topbar form { margin-left: auto; }

.nav-button,
.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 0;
  text-decoration: none;
  cursor: pointer;
  transition: color .16s ease;
}

.nav-button:hover,
.nav-button:focus-visible,
.text-button:hover,
.text-button:focus-visible {
  color: var(--text);
  outline: none;
}

.shell {
  max-width: 1180px;
  margin: auto;
  padding: 48px 24px 80px;
}

.eyebrow {
  color: var(--green);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 10px; font-size: 27px; font-weight: 500; letter-spacing: -.025em; }
h3 { font-size: 18px; font-weight: 500; }
.muted, small { color: var(--muted); }

.panel {
  margin-bottom: 20px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(36, 37, 42, .96), rgba(23, 24, 27, .96));
  box-shadow: 0 18px 60px rgba(0, 0, 0, .18);
}

.login-layout {
  width: min(100%, 420px);
  min-height: calc(100vh - 128px);
  min-height: calc(100svh - 128px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-panel { width: 100%; }

.login-panel label {
  display: block;
  margin: 0 0 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
}

input {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  background: #111214;
  color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease;
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(103, 232, 88, .12);
}

input[data-pin-input] {
  text-align: center;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: .55em;
  padding-left: calc(16px + .55em);
}

button, .button {
  border: 0;
  border-radius: 12px;
  padding: 12px 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  transition: transform .14s ease, background .14s ease, opacity .14s ease;
}

.primary { background: var(--green); color: #10210f; }
.primary:hover { background: #79f36c; transform: translateY(-1px); }
.secondary { background: #303137; color: var(--text); }
.secondary:hover { background: #3a3b42; }
.danger { background: rgba(255, 91, 102, .12); color: #ff8c93; }
.danger:hover { background: rgba(255, 91, 102, .2); }
.wide { width: 100%; margin-top: 14px; }
.compact { padding: 9px 12px; }

.reset-login { margin-top: 6px; text-align: center; }
.reset-login .text-button { padding: 10px; }

.pin-keypad {
  width: min(100%, 260px);
  margin: 18px auto 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pin-keypad button {
  min-height: 52px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
}

.pin-keypad button:hover,
.pin-keypad button:focus-visible {
  border-color: #4b4d54;
  background: var(--surface-2);
  outline: none;
}

.section-heading {
  margin-bottom: 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.section-heading h2 { margin: 5px 0 0; }
.counter { padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.choice-card {
  min-height: 220px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #18191c;
}

.choice-card strong { margin-bottom: 9px; font-size: 21px; }
.choice-card > span { flex: 1; color: var(--muted); line-height: 1.45; }
.choice-card button { width: 100%; margin-top: 22px; }

.access-list, .user-list { display: flex; flex-direction: column; }

.access-row, .user-row {
  padding: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
}

.access-row:first-child, .user-row:first-child { border-top: 0; }
.access-name { display: flex; align-items: center; gap: 14px; }

.access-name strong, .user-row strong { display: block; font-weight: 500; }
.access-name small, .user-row small { display: block; margin-top: 4px; }
.row-actions { display: flex; align-items: center; gap: 8px; }

.notice {
  margin-bottom: 20px;
  padding: 18px 20px;
  border: 1px solid rgba(245, 215, 110, .28);
  border-radius: 16px;
  background: rgba(245, 215, 110, .08);
  color: #f6e6aa;
}

.instruction summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
}

.instruction summary::-webkit-details-marker { display: none; }
.instruction summary strong { display: block; margin-top: 6px; font-size: 22px; }
.instruction-grid {
  margin-top: 22px;
  padding-top: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 38px;
  border-top: 1px solid var(--line);
}

ol { padding-left: 20px; color: var(--muted); line-height: 1.55; }
li + li { margin-top: 8px; }
.add-user { margin-bottom: 18px; display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; }
.admin-badge { padding: 7px 10px; border-radius: 999px; background: var(--green-dark); color: #a8f59f; font-size: 12px; }

.alerts { margin-bottom: 18px; display: grid; gap: 8px; }
.alert { padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.alert.success { border-color: rgba(103, 232, 88, .3); color: #bcf7b5; }
.alert.error { border-color: rgba(255, 91, 102, .3); color: #ffadb2; }
.auto-download { display: none; }
.error-card { padding: 70px 30px; text-align: center; }
.error-code { color: var(--green); font-size: 80px; font-weight: 500; }
.error-card h1 { font-size: 28px; }
.error-card .button { margin-top: 12px; }

@media (max-width: 760px) {
  .topbar { height: 64px; padding: 0 16px; }
  .shell { padding: 32px 16px 60px; }
  .login-layout { min-height: calc(100vh - 92px); min-height: calc(100svh - 92px); }
  .choice-grid, .instruction-grid { grid-template-columns: 1fr; }
  .access-row { align-items: flex-start; flex-direction: column; }
  .row-actions { width: 100%; }
  .row-actions > a, .row-actions form, .row-actions button { width: 100%; flex: 1; }
  .add-user { grid-template-columns: 1fr; }
  .user-row { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
