:root {
  --bg: #09090b;
  --bg-elevated: #0c0c0e;
  --surface: #111113;
  --surface-hover: #18181b;
  --ink: #fafafa;
  --muted: #a1a1aa;
  --faint: #71717a;
  --line: #27272a;
  --line-soft: #1f1f23;
  --accent: #34d399;
  --accent-dim: rgba(52, 211, 153, 0.12);
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.12);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 0.75rem;
  --font: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Syne", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 85% -10%, rgba(52, 211, 153, 0.08), transparent 55%),
    radial-gradient(700px 420px at -5% 30%, rgba(96, 165, 250, 0.05), transparent 50%),
    var(--bg);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
}

input {
  font: inherit;
  color: inherit;
}

.shell {
  width: min(100% - 2rem, 56rem);
  margin: 0 auto;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
}

.top.is-scrolled {
  border-bottom-color: var(--line-soft);
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.04em;
}

.logo span { color: var(--accent); }

.top-right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-ghost {
  padding: 0.5rem 0.8rem;
  border-radius: 0.55rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  transition: color 0.15s ease, background 0.15s ease;
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--surface);
}

.btn-solid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  padding: 0.45rem 0.95rem;
  border-radius: 0.55rem;
  background: var(--ink);
  color: #09090b;
  font-weight: 700;
  font-size: 0.9rem;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.btn-solid:hover { opacity: 0.92; }
.btn-solid:active { transform: translateY(1px); }
.btn-solid:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.45rem 0.9rem;
  border-radius: 0.55rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.88rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-outline:hover {
  background: var(--surface);
  border-color: #3f3f46;
}

.btn-danger {
  color: var(--danger);
  font-weight: 600;
  font-size: 0.84rem;
  padding: 0.4rem 0.65rem;
  border-radius: 0.45rem;
}

.btn-danger:hover { background: var(--danger-dim); }

.user-menu { position: relative; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.22rem 0.55rem 0.22rem 0.22rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.user-chip:hover {
  border-color: #3f3f46;
  background: var(--surface-hover);
}

.user-chip img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line);
}

.user-chip .meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  padding-right: 0.25rem;
  text-align: left;
}

.user-chip .name {
  font-size: 0.82rem;
  font-weight: 650;
}

.user-chip .mail {
  font-size: 0.7rem;
  color: var(--faint);
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 11.5rem;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: none;
}

.user-menu.open .user-menu-panel { display: grid; }

.user-menu-panel a,
.user-menu-panel button {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-radius: 0.45rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted);
}

.user-menu-panel a:hover,
.user-menu-panel button:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.page {
  padding: 2.5rem 0 4rem;
}

.page-head {
  margin-bottom: 1.75rem;
  opacity: 0;
  transform: translateY(10px);
  animation: rise 0.55s ease 0.05s forwards;
}

.page-kicker {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-head h1 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  max-width: 32rem;
  font-size: 0.98rem;
}

.apps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  opacity: 0;
  transform: translateY(10px);
  animation: rise 0.55s ease 0.16s forwards;
}

.app {
  display: grid;
  gap: 0.35rem;
  padding: 1.15rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.app:hover {
  border-color: #3f3f46;
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.app strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.app span {
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  opacity: 0;
  transform: translateY(10px);
  animation: rise 0.55s ease 0.14s forwards;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.15rem;
  margin-bottom: 1rem;
}

.profile-card img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line);
}

.profile-card .who {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.profile-card .who strong {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.profile-card .who span {
  color: var(--muted);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel { padding: 1.1rem 1.15rem 1.2rem; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.keys-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line-soft);
  border-radius: 0.6rem;
  background: var(--bg-elevated);
}

.key-row.revoked { opacity: 0.5; }

.key-row .meta {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.key-row .meta strong {
  font-size: 0.92rem;
}

.key-row .meta span {
  color: var(--faint);
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.keys-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.6rem 0.15rem;
}

.foot {
  border-top: 1px solid var(--line-soft);
  padding: 1.2rem 0 1.8rem;
  color: var(--faint);
  font-size: 0.82rem;
}

.sheet[hidden] { display: none; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
}

.sheet-card {
  position: relative;
  width: min(100%, 400px);
  padding: 1.45rem 1.3rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: pop 0.22s ease;
}

.sheet-x {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border-radius: 0.45rem;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
}

.sheet-x:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.sheet-kicker {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sheet-card h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: -0.04em;
}

.sheet-copy {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.85rem;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--bg-elevated);
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.google-btn:hover {
  background: var(--surface-hover);
  border-color: #3f3f46;
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.85rem;
}

.field span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.field input {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--bg);
  outline: none;
}

.field input:focus {
  border-color: #52525b;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.key-box {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.key-box code {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  word-break: break-all;
  max-height: 7.5rem;
  overflow: auto;
  color: var(--muted);
}

.callback-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
}

.callback-wrap h1 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: -0.04em;
}

.callback-wrap p {
  margin: 0;
  color: var(--muted);
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 640px) {
  .apps { grid-template-columns: 1fr; }
  .user-chip .mail { display: none; }
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }
}
