:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #15202b;
  --muted: #5b6b7c;
  --line: #d7dee7;
  --accent: #0b6e4f;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 10px 30px rgba(21, 32, 43, 0.06);
  --radius: 14px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d9f2e8 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #e7eef8 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: min(1100px, calc(100% - 32px)); margin: 0 auto; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  gap: 16px;
}
.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}
.nav { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.nav a { color: var(--muted); font-weight: 500; }
.nav a.active, .nav a:hover { color: var(--ink); text-decoration: none; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
h1, h2, h3 { margin: 0 0 12px; line-height: 1.2; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.label { display: grid; gap: 6px; font-size: 0.92rem; font-weight: 600; }
input, select, textarea, button {
  font: inherit;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
textarea { min-height: 110px; font-family: var(--mono); font-size: 0.9rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.flash {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  border: 1px solid;
}
.flash.success { background: #ecfdf3; border-color: #abefc6; color: var(--ok); }
.flash.error { background: #fef3f2; border-color: #fecdca; color: var(--danger); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}
.badge.active { background: #dcfae6; color: var(--ok); }
.badge.disabled, .badge.revoked { background: #fee4e2; color: var(--danger); }
.identity {
  display: flex;
  gap: 18px;
  align-items: center;
}
.avatar {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: #e8f5ef;
  display: grid;
  place-items: center;
  font-size: 2rem;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.app-list { display: grid; gap: 12px; }
.app-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat {
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc, #fff);
  border: 1px solid var(--line);
}
.stat strong { display: block; font-size: 1.6rem; }
.login-wrap { width: min(420px, calc(100% - 32px)); margin: 6vh auto; text-align: center; }
.login-brand { display: inline-block; text-decoration: none; }
.login-logo {
  display: block;
  width: min(220px, 70vw);
  height: auto;
  margin: 0 auto;
}
.login-card { margin-top: 18px; text-align: left; }
.login-card h1 { text-align: center; }
.login-card > .muted { text-align: center; }
.login-identifier-block { display: grid; gap: 8px; }
.login-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
}
.login-mode-btn {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.login-mode-btn.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(21, 32, 43, 0.08);
}
.login-mode-btn:hover:not(.active) { color: var(--ink); }
#login-form[data-mode="password"] #login-submit-email,
#login-form[data-mode="email"] #login-submit-password,
#login-form[data-mode="email"] .login-password-fields {
  display: none;
}
.login-last-used {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  max-width: 100%;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.login-last-used[hidden] {
  display: none;
}
.login-last-used:hover {
  border-color: var(--accent);
  background: #eef8f4;
}
.login-last-used-label {
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}
.login-last-used-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.mono { font-family: var(--mono); font-size: 0.85rem; word-break: break-all; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.footer { padding: 28px 0 40px; color: var(--muted); font-size: 0.9rem; }
.docs { line-height: 1.55; }
.docs pre {
  background: #0f1720;
  color: #e7eef8;
  padding: 14px;
  border-radius: 12px;
  overflow: auto;
}
.docs code { font-family: var(--mono); font-size: 0.9em; }
.checkbox-grid { display: grid; gap: 8px; }
.checkbox-grid label {
  font-weight: 500;
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}
.checkbox-grid input[type="checkbox"] {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
}
.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--muted);
}
.inline-check input { width: auto; }
@media (max-width: 640px) {
  .identity { flex-direction: column; align-items: flex-start; }
  .app-item { flex-direction: column; align-items: flex-start; }
}
