:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --ink: #16191f;
  --muted: #657080;
  --line: #dfe5ed;
  --panel: #ffffff;
  --soft: #eef7fb;
  --accent: #00a6c8;
  --accent-dark: #007d99;
  --nav: #111419;
  --success: #167f53;
  --danger: #b93434;
  --shadow: 0 18px 45px rgba(18, 26, 38, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  background:
    linear-gradient(180deg, rgba(0, 166, 200, 0.08), rgba(0, 166, 200, 0) 280px),
    var(--bg);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(17, 20, 25, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 20, 25, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 420px);
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 30px;
  background: rgba(17, 20, 25, 0.96);
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 10px 28px rgba(17, 20, 25, 0.18);
}

.brand,
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  text-decoration: none;
}

.brand span:last-child,
.brand-lockup div {
  display: grid;
  gap: 1px;
}

.brand strong,
.brand-lockup strong {
  color: #ffffff;
  font-size: 15px;
  line-height: 1.1;
}

.brand small,
.brand-lockup small {
  color: #9be4f2;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16);
}

.brand-mark.small {
  width: 36px;
  height: 36px;
}

nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

nav a,
.link-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 0 12px;
  color: #c4ccd7;
  text-decoration: none;
  font: inherit;
  font-size: 14px;
}

nav a.active {
  background: rgba(0, 166, 200, 0.16);
  color: #ffffff;
}

.link-button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  cursor: pointer;
}

.link-button:hover {
  border-color: rgba(155, 228, 242, 0.7);
  background: rgba(255, 255, 255, 0.07);
}

main {
  position: relative;
  width: min(1140px, calc(100% - 32px));
  margin: 34px auto;
}

.login-box {
  width: min(460px, 100%);
  margin: 74px auto;
  background: var(--nav);
  border-radius: 8px;
  padding: 32px;
  color: #ffffff;
  box-shadow: var(--shadow);
}

.login-box h1 {
  color: #ffffff;
}

.login-box p,
.login-box label,
.login-box .hint {
  color: #b9c5d3;
}

.login-box input {
  border-color: rgba(255, 255, 255, 0.18);
  background: #ffffff;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 31px;
  line-height: 1.14;
  font-weight: 800;
}

h2 {
  margin-bottom: 16px;
  font-size: 17px;
  line-height: 1.3;
}

p,
span,
td,
th,
label {
  color: var(--muted);
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

form {
  margin: 0;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 43px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 166, 200, 0.15);
}

button {
  min-height: 43px;
  border: 0;
  border-radius: 6px;
  padding: 0 17px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  white-space: normal;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  min-height: 34px;
  background: #edf3f8;
  color: var(--ink);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.panel,
.password-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 21px;
  box-shadow: 0 12px 28px rgba(18, 26, 38, 0.05);
}

.account-panel {
  width: min(520px, 100%);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.admin-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow-x: auto;
}

.admin-tabs a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 0 14px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.admin-tabs a.active {
  background: var(--nav);
  color: #ffffff;
}

.stat-card {
  min-height: 104px;
  display: grid;
  align-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--nav);
  box-shadow: var(--shadow);
}

.stat-card span {
  color: #9be4f2;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-card strong {
  color: #ffffff;
  font-size: 34px;
  line-height: 1;
}

.admin-grid,
.password-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.admin-grid.single {
  grid-template-columns: minmax(280px, 420px);
}

.password-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.password-card {
  position: relative;
  display: grid;
  grid-template-rows: minmax(78px, auto) auto auto;
  gap: 16px;
  align-content: start;
  overflow: hidden;
  min-height: 300px;
}

.password-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--accent);
}

.password-card h2 {
  margin-bottom: 4px;
  min-height: 44px;
  display: flex;
  align-items: flex-start;
}

.password-card span {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.password-card code {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0;
}

.challenge-form {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 12px;
}

.challenge-form label {
  margin-bottom: 0;
}

.password-card form:not(.challenge-form) {
  display: grid;
  align-self: start;
}

.password-card button {
  width: 100%;
  min-width: 0;
  min-height: 44px;
}

.inline-error {
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

.wide {
  margin-top: 18px;
  overflow-x: auto;
}

.inline-edit-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 340px;
}

.inline-edit-form input {
  min-height: 36px;
}

.inline-edit-form button {
  min-height: 36px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 13px 10px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--ink);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f8fbfd;
}

.seed {
  font-family: Consolas, Monaco, monospace;
  color: #3d4754;
}

.flash {
  border: 1px solid rgba(22, 127, 83, 0.22);
  border-radius: 6px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: #ecf9f3;
  color: var(--success);
  font-weight: 700;
}

.flash.error,
.panel.error {
  background: #fff0f0;
  color: var(--danger);
  border-color: #f0b8b8;
}

.hint {
  margin: 16px 0 0;
  font-size: 13px;
}

@media (max-width: 820px) {
  header,
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  header {
    padding: 14px 18px;
  }

  nav {
    width: 100%;
  }

  .admin-tabs {
    width: 100%;
  }

  main {
    margin-top: 24px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 480px) {
  .login-box {
    margin-top: 34px;
    padding: 24px;
  }

  h1 {
    font-size: 26px;
  }

  .password-card code {
    font-size: 30px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}
