:root {
  --ink: #0c0a09;
  --paper: #f5efe6;
  --dim: #8c857a;
  --soft: #cfc8bd;
  --accent: #ff5b22;
  --line: rgba(245, 239, 230, 0.12);
  --panel: rgba(245, 239, 230, 0.035);
  --grid: rgba(245, 239, 230, 0.05);
  --ok: #6fcf97;
  --warn: #f2c94c;
  --bad: #eb5757;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: "Instrument Serif", "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    radial-gradient(ellipse at 18% -5%, rgba(255, 91, 34, 0.16), transparent 55%),
    radial-gradient(ellipse at 85% 105%, rgba(80, 60, 200, 0.14), transparent 60%);
  background-size: 64px 64px, 64px 64px, 100% 100%, 100% 100%;
  background-attachment: fixed;
  position: relative;
  padding: clamp(1.25rem, 3vw, 2.5rem);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Mono utility face: eyebrows, labels, data, buttons */
.mono, .eyebrow, .label, button, input, select, th, .pill, .meta, code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top bar shared by account + admin shells */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 880px;
  margin: 0 auto clamp(1.5rem, 4vw, 3rem);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}
.topbar .brand { color: var(--paper); display: inline-flex; align-items: center; }
.topbar a { color: var(--dim); }
.topbar a:hover { color: var(--accent); text-decoration: none; }

.dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 0.55rem;
  box-shadow: 0 0 14px var(--accent);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--dim);
}

h1 {
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}
h1 .tld { font-style: italic; color: var(--accent); }

.shell { max-width: 880px; margin: 0 auto; position: relative; z-index: 2; }

/* Centered auth card */
.auth {
  max-width: 420px;
  margin: clamp(2rem, 8vh, 6rem) auto 0;
}
.auth h1 { font-size: clamp(3rem, 9vw, 4.5rem); margin: 0.5rem 0 0.25rem; }
.auth .lede { color: var(--soft); font-style: italic; font-size: 1.15rem; margin-bottom: 2rem; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  backdrop-filter: blur(2px);
}
.card + .card { margin-top: 1.25rem; }

/* Section blocks in dashboards */
.block { margin-bottom: 2rem; }
.block > .eyebrow { display: block; margin-bottom: 0.9rem; }
.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 0.9rem;
}
.section-title h2 { font-weight: 400; font-size: 1.6rem; }

/* Forms */
label.field { display: block; margin-bottom: 0.85rem; }
label.field span {
  display: block;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 0.35rem;
}
input, select {
  width: 100%;
  background: rgba(12, 10, 9, 0.5);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--paper);
  padding: 0.6rem 0.7rem;
  font-size: 0.85rem;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper);
  border-radius: 7px;
  padding: 0.6rem 0.9rem;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}
button:hover { border-color: var(--accent); color: var(--accent); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--ink); border-color: var(--accent); font-weight: 600; }
button.primary:hover { background: #ff6f3c; color: var(--ink); }
button.block-btn { width: 100%; }
button:disabled { opacity: 0.45; cursor: default; }
button.danger:hover { border-color: var(--bad); color: var(--bad); }

.row { display: flex; gap: 0.6rem; }
.row > * { flex: 1; }
.stack-sm { display: grid; gap: 0.6rem; }

.divider {
  display: flex; align-items: center; gap: 0.8rem;
  color: var(--dim); font-size: 0.66rem; letter-spacing: 0.18em; text-transform: uppercase;
  margin: 1.25rem 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* List rows (linked accounts, passkeys, submissions) */
.list { display: grid; gap: 0.6rem; }
.item {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 0.75rem 0.9rem;
  background: rgba(12, 10, 9, 0.3);
}
.item .who { display: flex; flex-direction: column; gap: 0.15rem; }
.item .who strong { font-weight: 400; font-size: 1.15rem; }
.item .who small { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.66rem; color: var(--dim); letter-spacing: 0.04em; }

.pill {
  font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.2rem 0.5rem; border-radius: 99px; border: 1px solid var(--line); color: var(--dim);
}
.pill.admin { color: var(--accent); border-color: var(--accent); }
.pill.banned { color: var(--bad); border-color: var(--bad); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th {
  text-align: left; font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--dim); font-weight: 400; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line);
}
td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }

/* Tabs (admin) */
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tabs button.tab[aria-selected="true"] { border-color: var(--accent); color: var(--accent); }

/* Avatar */
.avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--line); background: var(--panel);
}

.note { color: var(--dim); font-size: 0.85rem; font-style: italic; }
.error { color: var(--bad); font-size: 0.8rem; font-family: "JetBrains Mono", ui-monospace, monospace; }
.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--paper); color: var(--ink); padding: 0.6rem 1rem; border-radius: 8px;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.75rem;
  z-index: 10; box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.hidden { display: none !important; }

.google-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem; }
.google-btn svg { width: 16px; height: 16px; }

@media (max-width: 540px) {
  /* The topbar right holds the admin + sign-out links, so keep it visible;
     just let it stay compact next to the brand. */
  .topbar .right { display: inline-flex; gap: 0.9rem; }
  .row { flex-direction: column; }
}
