:root {
  --ink: #0a0a0a;
  --ink2: #3a3a3a;
  --ink3: #888;
  --paper: #faf9f7;
  --paper2: #f2f0ec;
  --accent: #1a6bff;
  --border: rgba(0, 0, 0, 0.08);
  --red: #dc2626;
  --r-sm: 6px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Geist', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 56px;
  border-bottom: 1px solid var(--border);
}
.nav-logo { font-family: 'Geist Mono', monospace; font-size: 17px; font-weight: 500; color: var(--ink); text-decoration: none; }
.nav-logo span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-auth { display: inline-flex; align-items: center; gap: 6px; }
.nav-auth:not(.nav-auth-ready) { opacity: 0; pointer-events: none; }
.nav-auth.nav-auth-ready { opacity: 1; pointer-events: auto; }
.nav-link {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink2);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--paper2); color: var(--ink); }

.account-wrap { max-width: 800px; margin: 0 auto; padding: 32px 24px 64px; }
.account-h1 { font-family: 'Instrument Serif', serif; font-size: 2rem; font-weight: 400; margin-bottom: 8px; }
.account-lead { color: var(--ink3); margin-bottom: 32px; font-size: 14px; }

.profile-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 20px 24px;
  margin-bottom: 32px;
}
.profile-card h2 { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--ink2); }
.profile-row { font-size: 15px; margin-bottom: 6px; }
.profile-row span { color: var(--ink3); margin-right: 8px; }

.section-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; }

.form-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 24px;
  margin-bottom: 32px;
}
.form-card h2 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--ink2); }
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 15px;
  font-family: inherit;
}
.form-input[type="date"] { cursor: pointer; min-height: 42px; }
textarea.form-input { min-height: 72px; resize: vertical; }
.scope-grid { display: flex; flex-direction: column; gap: 10px; }
.scope-item { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; }
.scope-item input { margin-top: 3px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink2); border: 1px solid var(--border); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(220, 38, 38, 0.35); font-size: 13px; padding: 6px 12px; }

.key-list { display: flex; flex-direction: column; gap: 12px; }
.key-row {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.key-row-main { flex: 1; min-width: 200px; }
.key-name { font-weight: 600; margin-bottom: 4px; }
.key-meta { font-size: 13px; color: var(--ink3); }
.key-prefix { font-family: 'Geist Mono', monospace; font-size: 13px; color: var(--ink2); margin-top: 6px; }
.key-scopes { font-size: 12px; color: var(--ink3); margin-top: 6px; }
.status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
  margin-top: 4px;
}
.status-ok { background: rgba(34, 197, 94, 0.15); color: #15803d; }
.status-exp { background: rgba(234, 179, 8, 0.2); color: #a16207; }
.status-rev { background: rgba(0, 0, 0, 0.06); color: var(--ink3); }

.empty-hint { color: var(--ink3); font-size: 14px; padding: 24px; text-align: center; border: 1px dashed var(--border); border-radius: var(--r-sm); }

.form-error { color: var(--red); font-size: 13px; margin-top: 8px; display: none; }
.form-error.show { display: block; }

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 10px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-weight: 600; font-size: 16px; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--ink3); }
.modal-body { padding: 20px; }
.modal-foot { padding: 12px 20px 20px; display: flex; justify-content: flex-end; gap: 8px; }
.secret-box {
  font-family: 'Geist Mono', monospace;
  font-size: 13px;
  word-break: break-all;
  background: var(--paper2);
  padding: 12px;
  border-radius: var(--r-sm);
  margin: 12px 0;
  border: 1px solid var(--border);
}
.secret-warn { font-size: 13px; color: var(--red); margin-bottom: 8px; }

@media (max-width: 640px) {
  nav { padding: 0 16px; }
  .account-wrap { padding: 24px 16px; }
}
