:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.1);
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --success: #248a3d;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(0, 113, 227, 0.1), transparent 32rem),
    radial-gradient(circle at 90% 90%, rgba(175, 82, 222, 0.08), transparent 28rem),
    var(--bg);
}

button, input { font: inherit; }

.auth-shell, .dashboard-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.auth-card, .dashboard-card {
  width: min(100%, 430px);
  padding: 38px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.12), 0 2px 12px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(24px) saturate(150%);
}

.dashboard-card { width: min(100%, 720px); }

.mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 28px;
  border-radius: 16px;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(145deg, #19191b, #4b4b50);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24), 0 8px 24px rgba(0,0,0,.2);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 6vw, 40px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.lede {
  margin: 16px 0 26px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.auth-form { display: grid; gap: 10px; }

label {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: var(--surface-solid);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, .14);
}

button, .button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  margin-top: 12px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}

button:hover, .button-link:hover { background: var(--blue-hover); }
button:active, .button-link:active { transform: scale(.985); }

button.secondary {
  color: var(--text);
  background: rgba(118, 118, 128, .12);
}

button.secondary:hover { background: rgba(118, 118, 128, .18); }

.notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.notice.error { color: var(--danger); background: var(--danger-bg); }

.privacy-note {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.scope-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -4px 0 22px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(118, 118, 128, .06);
  font-size: 13px;
  line-height: 1.4;
}

.scope-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(36, 138, 61, .13);
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--success);
  background: rgba(36, 138, 61, .1);
  font-size: 12px;
  font-weight: 700;
}

.status-pill span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.endpoint-list { display: grid; gap: 1px; margin: 26px 0; }

.endpoint-list div {
  display: grid;
  grid-template-columns: 155px minmax(0, 1fr);
  gap: 16px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.endpoint-list dt { color: var(--muted); font-size: 13px; }
.endpoint-list dd { margin: 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
code { font-family: "SFMono-Regular", Consolas, monospace; font-size: .92em; }
.logout-form { display: flex; justify-content: flex-end; }

@media (max-width: 560px) {
  .auth-card, .dashboard-card { padding: 28px 22px; border-radius: 22px; }
  .dashboard-header { display: grid; }
  .endpoint-list div { grid-template-columns: 1fr; gap: 6px; }
  .logout-form button { width: 100%; }
}

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

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0d;
    --surface: rgba(29, 29, 31, .88);
    --surface-solid: #242426;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --line: rgba(255,255,255,.12);
    --danger: #ff6961;
    --danger-bg: rgba(255, 69, 58, .12);
  }
  .auth-card, .dashboard-card { border-color: rgba(255,255,255,.1); }
}
