:root {
  --ink: #17313a;
  --muted: #597078;
  --paper: #f4f0e7;
  --surface: #fffdf8;
  --line: #d8d3c7;
  --primary: #d9503d;
  --primary-dark: #a83628;
  --teal: #0c706e;
  --teal-soft: #e1f1ed;
  --warning: #9a5b00;
  --shadow: 0 18px 50px rgb(23 49 58 / 12%);
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 90% 0%, rgb(12 112 110 / 10%), transparent 30rem),
    var(--paper);
}

button,
input,
select { font: inherit; }

button { cursor: pointer; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 8px;
  transform: translateY(-150%);
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  padding: 10px 14px;
}

.skip-link:focus { transform: translateY(0); }

.topbar {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 12px max(20px, calc((100vw - 1120px) / 2));
  background: rgb(244 240 231 / 92%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand > span:first-child {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: var(--surface);
  font-size: 0.78rem;
  font-weight: 850;
}

.brand strong,
.brand small { display: block; }

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.account-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: clamp(30px, 6vw, 72px) 0 80px;
}

.auth-card {
  width: min(520px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  padding: clamp(24px, 5vw, 42px);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p { margin-top: 0; }

h1 {
  margin-bottom: 12px;
  font-size: clamp(1.8rem, 5vw, 2.7rem);
  letter-spacing: -0.04em;
  line-height: 1.02;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.security-points {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.security-points span {
  position: relative;
  color: var(--ink);
  padding-left: 22px;
  font-size: 0.82rem;
  font-weight: 750;
}

.security-points span::before {
  position: absolute;
  top: 0.25em;
  left: 0;
  width: 10px;
  height: 10px;
  border: 2px solid var(--teal);
  border-radius: 50%;
  content: "";
}

.stack-form,
.invite-grid {
  display: grid;
  gap: 9px;
  margin-top: 24px;
}

label {
  margin-top: 6px;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgb(12 112 110 / 15%);
}

.primary-button,
.secondary-button,
.quiet-button {
  min-height: 44px;
  border-radius: 10px;
  padding: 9px 15px;
  font-weight: 820;
}

.primary-button {
  border: 0;
  background: var(--ink);
  color: var(--surface);
}

.secondary-button {
  width: 100%;
  border: 1px solid var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.quiet-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.form-status {
  min-height: 1.35em;
  margin: 3px 0;
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 700;
}

.turnstile-container {
  min-height: 0;
  margin-top: 8px;
}

.mfa-enrollment {
  margin: 20px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 16px;
  text-align: center;
}

.mfa-enrollment img {
  display: block;
  width: min(220px, 100%);
  margin: 0 auto 12px;
}

.secret-output {
  display: block;
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: var(--paper);
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.78rem;
}

.dashboard {
  display: grid;
  gap: 20px;
}

.dashboard-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-heading { margin-bottom: 10px; }

.dashboard-heading h1 { margin-bottom: 8px; }

.role-badge,
.account-role,
.account-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.7rem;
  font-weight: 850;
  white-space: nowrap;
}

.role-badge,
.account-role {
  background: var(--teal-soft);
  color: var(--teal);
}

.account-status {
  background: var(--paper);
  color: var(--muted);
}

.account-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.row-action {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 6px 9px;
  font-size: 0.7rem;
  font-weight: 800;
}

.dashboard-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: clamp(20px, 4vw, 30px);
}

.invite-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
}

.invite-grid label,
.invite-grid .form-status { grid-column: 1 / -1; }

.data-list {
  display: grid;
  gap: 0;
  margin-top: 12px;
}

.data-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(110px, 0.7fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 66px;
  border-top: 1px solid var(--line);
  padding: 11px 0;
}

.data-row strong,
.data-row small { display: block; }

.data-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.empty-state {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 20px 0;
}

[hidden] { display: none !important; }

@media (max-width: 680px) {
  .topbar { min-height: 68px; padding-inline: 14px; }
  .account-shell { width: min(100% - 20px, 1120px); padding-top: 20px; }
  .dashboard-heading { display: grid; }
  .section-heading { align-items: center; }
  .invite-grid { grid-template-columns: 1fr; }
  .invite-grid label,
  .invite-grid .form-status { grid-column: auto; }
  .data-row { grid-template-columns: minmax(0, 1fr) auto; }
  .data-row > :nth-child(2) { grid-column: 1; }
  .data-row > :nth-child(3) { grid-column: 2; grid-row: 1 / span 2; }
}
