:root {
  --black:    #000;
  --white:    #fff;
  --gray-50:  #fafafa;
  --gray-100: #f0f0f0;
  --gray-200: #e0e0e0;
  --gray-400: #999;
  --gray-600: #555;
  --red:      #c00;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --border: 1px solid var(--black);
  --border-color: var(--gray-200);
  --radius: 0;

  --fg: var(--black);
  --fg-muted: var(--gray-600);
  --bg: var(--white);
  --surface: var(--white);
  --accent: var(--black);
  --accent-fg: var(--white);
  --danger: var(--red);

  --header-height: 48px;

  font-family: var(--font);
  font-size: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height);
  padding: 0 2rem;
  background: var(--white);
  border-bottom: var(--border);
  flex-shrink: 0;
}
header h1 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
}
.header-actions { display: flex; gap: 0.75rem; align-items: center; }

main {
  padding: 2rem;
  max-width: 880px;
  margin: 0 auto;
  flex: 1;
  width: 100%;
}

h1, h2, h3 { font-weight: 600; }
h1 { font-size: 18px; margin: 0 0 1.5rem; }
h2 { font-size: 14px; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 13px; margin: 1rem 0 0.5rem; }

.muted { color: var(--fg-muted); }
.error { color: var(--danger); font-size: 12px; padding: 0.6rem 0.75rem; border: 1px solid var(--danger); background: #fff5f5; margin-bottom: 0.5rem; }
.success { color: var(--black); font-size: 12px; padding: 0.6rem 0.75rem; border: var(--border); background: var(--gray-50); margin-bottom: 0.5rem; }

.card {
  border: var(--border);
  padding: 1.5rem;
  background: var(--surface);
  margin-bottom: 1rem;
}

.card-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.card-row .meta { font-size: 11px; color: var(--fg-muted); }

label {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
label .hint { display: block; font-size: 11px; font-weight: 400; color: var(--fg-muted); margin-top: 0.25rem; }

input, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--black);
  outline: none;
}
input:focus, textarea:focus {
  background: var(--gray-50);
  box-shadow: inset 0 0 0 2px var(--black);
  outline: none;
}
textarea { font-family: var(--font-mono); font-size: 12px; min-height: 5rem; }

button, .button {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.6rem 1.25rem;
  border: var(--border);
  background: var(--white);
  color: var(--black);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { background: var(--gray-100); }
button.primary, .button.primary { background: var(--black); color: var(--white); }
button.primary:hover, .button.primary:hover { background: var(--gray-600); }
button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
button.danger:hover { background: #fff5f5; }
button[disabled] { opacity: 0.5; cursor: not-allowed; }

.row-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.client-list { list-style: none; padding: 0; margin: 0; }
.client-list li { margin-bottom: 1rem; }

.kv { font-family: var(--font-mono); font-size: 12px; color: var(--fg); word-break: break-all; }
.kv-label { display: inline-block; min-width: 8rem; color: var(--fg-muted); }

.scopes, .grants { display: inline-flex; gap: 0.25rem; flex-wrap: wrap; }
.scopes span, .grants span {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border-color);
  background: var(--gray-50);
  font-size: 11px;
  font-family: var(--font-mono);
}

.secret-banner {
  border: 2px solid var(--black);
  padding: 1rem;
  margin: 1rem 0;
  background: var(--gray-50);
}
.secret-banner code {
  display: block;
  word-break: break-all;
  margin: 0.5rem 0;
  font-size: 12px;
}

footer {
  border-top: 1px solid var(--border-color);
  padding: 1rem 2rem;
  text-align: center;
  font-size: 11px;
  color: var(--fg-muted);
}

body.login main, body.consent main {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 420px;
}
body.login .card, body.consent .card { width: 100%; }

.consent-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.consent-actions form { flex: 1; }
.consent-actions button { width: 100%; }
