:root {
  --bg: #0e1116;
  --panel: #161b22;
  --line: #262c36;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #4493f8;
  --good: #34d17b;
  --bad: #f4605a;
  --warn: #d9a441;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 2rem;
}
h1 { margin: 0 0 0.25rem; font-size: 1.4rem; letter-spacing: -0.02em; }
.sub { margin: 0 0 1.5rem; color: var(--muted); font-size: 0.875rem; }
label { display: block; margin-bottom: 0.9rem; font-size: 0.8rem; color: var(--muted); }
input {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.6rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.95rem;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
button[type="submit"] {
  width: 100%;
  padding: 0.65rem;
  background: var(--accent);
  color: #06121f;
  border: 0;
  border-radius: 7px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
button[type="submit"]:hover { filter: brightness(1.08); }
.alt { margin: 1rem 0 0; font-size: 0.8rem; color: var(--muted); text-align: center; }
a, .link { color: var(--accent); text-decoration: none; }
a:hover, .link:hover { text-decoration: underline; }
.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.notice {
  margin-bottom: 1rem;
  padding: 0.6rem 0.75rem;
  border-radius: 7px;
  font-size: 0.85rem;
  border-left: 3px solid var(--bad);
  background: rgba(244, 96, 90, 0.1);
}
.notice.good { border-left-color: var(--good); background: rgba(52, 209, 123, 0.1); }
.notice.info { border-left-color: var(--accent); background: rgba(68, 147, 248, 0.1); }
.warn { color: var(--warn); font-size: 0.85rem; }
.apps { display: grid; gap: 0.5rem; margin: 1.25rem 0; }
.apps a {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
}
.apps a:hover { border-color: var(--accent); text-decoration: none; }

/* ---- account page ----
   The auth card is deliberately narrow; the account view holds tables and
   needs room, so the width comes from a class the page sets once signed in
   rather than from a media query. */
body.signed-in .card { max-width: 720px; }

.panel {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.panel h2 { margin: 0 0 0.75rem; font-size: 1rem; }
.panel h3 { margin: 1.5rem 0 0.5rem; font-size: 0.85rem; color: var(--muted); font-weight: 600; }

.balance-row { display: flex; gap: 2rem; align-items: baseline; margin-bottom: 0.5rem; }
.stat { display: flex; flex-direction: column; gap: 0.15rem; }
.stat-value { font-size: 1.75rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.75rem; color: var(--muted); }
.muted-stat .stat-value { color: var(--muted); font-size: 1.25rem; }

/* Tables scroll rather than squashing columns or pushing the page sideways. */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.4rem 0.6rem 0.4rem 0; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 0.5rem 0.6rem 0.5rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.credit-up { color: var(--good); }
.credit-down { color: var(--text); }

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85em; background: var(--bg); padding: 0.1rem 0.3rem; border-radius: 4px;
}

/* The one-time key reveal. Given real visual weight because it is the only
   moment this value exists, and a missed copy means minting a new key. */
.new-key {
  margin: 1rem 0; padding: 0.9rem;
  border: 1px solid var(--accent); border-radius: 8px;
  background: rgba(68, 147, 248, 0.08);
}
.new-key p { margin: 0 0 0.6rem; }
.key-reveal { display: flex; gap: 0.5rem; align-items: center; }
.key-reveal code {
  flex: 1; overflow-x: auto; white-space: nowrap; padding: 0.5rem; background: var(--bg);
}
.key-reveal button {
  padding: 0.45rem 0.8rem; background: var(--accent); color: #06121f;
  border: 0; border-radius: 6px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
}

.key-form { margin-top: 1.5rem; }
.scopes { border: 0; padding: 0; margin: 0 0 0.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.scopes legend { padding: 0; margin-bottom: 0.4rem; }
label.inline { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0; font-size: 0.8rem; color: var(--text); }
label.inline input { width: auto; margin: 0; display: inline-block; }
.danger { color: var(--bad); }

@media (max-width: 560px) {
  .card { padding: 1.25rem; }
  .balance-row { gap: 1.25rem; }
}
