@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f2f1ee;
  --surface: #ffffff;
  --sunken: #e7e5e0;
  --border: #b9b5ac;
  --text: #1b1b1a;
  --muted: #55534e;
  --accent: #c2410c;
  --accentText: #ffffff;
  --accentFg: #b23c0b;
  --hdr: #1b1b1a;
  --hdrText: #f2f1ee;
  --hdrMuted: #b9b5ac;
  --ph: #8a867d;
  --danger: #b42318;
  --focus: #c2410c;
  --ok: #2e9e5b;
  --font: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --hdr-h: 56px;
  --ftr-h: 28px;
  --cut: 8px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111213;
  --surface: #1b1d1f;
  --sunken: #0b0c0d;
  --border: #3d4145;
  --text: #e9e7e2;
  --muted: #a6a39c;
  --accent: #f97316;
  --accentText: #111213;
  --accentFg: #fb923c;
  --hdr: #0b0c0d;
  --hdrText: #e9e7e2;
  --hdrMuted: #a6a39c;
  --ph: #6e6b65;
  --danger: #f97066;
  --focus: #fb923c;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  font-weight: 400;
}
#app { min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); font-size: 12px; }
.mono { font-variant-ligatures: none; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.brand-g { width: 18px; height: 18px; }
.brand-x { width: 16px; height: 16px; }

.cut, .btn, .card, .menu, .token-once {
  clip-path: polygon(var(--c, var(--cut)) 0, 100% 0, 100% calc(100% - var(--c, var(--cut))), calc(100% - var(--c, var(--cut))) 100%, 0 100%, 0 var(--c, var(--cut)));
}
.btn {
  --c: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 14px;
  border: 0;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  font-weight: 600;
  text-decoration: none;
}
.btn.primary { background: var(--accent); color: var(--accentText); box-shadow: none; }
.btn.secondary { background: var(--surface); }
.btn.provider { width: 100%; min-height: 48px; margin-top: 10px; }
.btn.cut-sm { --c: 6px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.hdr {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--hdr-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--hdr);
  color: var(--hdrText);
  border-bottom: 3px solid var(--accent);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.03em;
}
.mark {
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid var(--accent);
}
.topnav { display: flex; gap: 4px; }
.top-link {
  color: var(--hdrMuted);
  padding: 16px 10px 12px;
  font-weight: 600;
  font-size: 13px;
}
.top-link.active { color: var(--hdrText); box-shadow: inset 0 -3px 0 var(--accent); }
.hdr-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; position: relative; }
.search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #3d4145;
  color: var(--hdrMuted);
  min-width: 180px;
}
.search input {
  background: transparent;
  border: 0;
  color: var(--hdrText);
  width: 140px;
  outline: none;
}
.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  color: var(--hdrText);
}
.hamburger { display: none; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--accentText);
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.static { cursor: default; }

.menu {
  --c: 12px;
  position: absolute;
  top: 44px;
  right: 0;
  width: 280px;
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
  z-index: 30;
  padding: 8px 0 10px;
}
.menu[hidden] { display: none; }
.menu a, .menu button[role="menuitem"] {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: transparent;
  border: 0;
  text-align: left;
  font-weight: 600;
}
.menu a:hover, .menu button[role="menuitem"]:hover { background: var(--sunken); }
.menu-id { display: flex; gap: 10px; padding: 8px 14px 12px; align-items: center; }
.menu-rule { height: 1px; background: var(--border); margin: 6px 0; }
.theme-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; font-weight: 600; }
.theme-row > span { display: inline-flex; gap: 8px; align-items: center; }
.theme-switch { display: flex; border: 1px solid var(--border); }
.theme-btn { width: 28px; height: 26px; border: 0; background: var(--surface); color: var(--text); display: grid; place-items: center; }
.theme-btn.on { background: var(--accent); color: var(--accentText); }

.shell { display: grid; grid-template-columns: 260px 1fr; gap: 16px; padding: 16px 18px 28px; flex: 1; }
.shell.no-rail { grid-template-columns: 1fr; }
.shell.no-rail .rail { display: none; }
.rail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 420px;
  padding: 8px 8px 16px;
  border-right: 1px solid var(--border);
}
.rail a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-weight: 600;
}
.rail a.sub { padding-left: 32px; font-weight: 400; color: var(--muted); }
.rail a.on { background: var(--sunken); box-shadow: inset 3px 0 0 var(--accent); color: var(--text); }
.rail-org { margin: 4px 10px 8px; color: var(--muted); font-size: 12px; }
.org-switch { position: relative; }
.org-switch > button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid #3d4145;
  color: var(--hdrText);
  font-weight: 600;
}
.org-menu {
  --c: 10px;
  position: absolute;
  top: 40px;
  right: 0;
  min-width: 260px;
  background: var(--surface);
  color: var(--text);
  z-index: 30;
  box-shadow: inset 0 0 0 1px var(--border);
  padding: 6px 0;
}
.org-menu[hidden] { display: none; }
.org-menu a { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 12px; font-weight: 600; }
.org-menu a:hover { background: var(--sunken); }
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--sunken);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.lede.left { text-align: left; }
.plugin-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.plugin-list li { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); padding: 12px 14px; }
.plugin-list span { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.signup h2 { font-size: 16px; margin: 22px 0 8px; }
.workspace { min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.page-head h1 { font-size: 26px; margin: 0; font-weight: 700; }
.page-head .btn { margin-left: auto; }
.chip {
  display: inline-block;
  border: 1px dashed var(--accentFg);
  color: var(--accentFg);
  font-size: 11px;
  padding: 2px 8px;
  font-weight: 600;
}
.chip.center { display: block; width: max-content; margin: 14px auto 0; }
.ph-grid { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 14px; }
.ph {
  background: var(--surface);
  border: 1px dashed var(--border);
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  background-image:
    linear-gradient(to bottom right, transparent calc(50% - 0.5px), var(--border) calc(50% - 0.5px), var(--border) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to bottom left, transparent calc(50% - 0.5px), var(--border) calc(50% - 0.5px), var(--border) calc(50% + 0.5px), transparent calc(50% + 0.5px));
  background-color: var(--surface);
}
.ph.span, .span { grid-column: 1 / -1; }
.ph.tall { min-height: 320px; }
.ph.short { min-height: 140px; margin-top: 12px; }
.ph strong { display: block; }

.ftr {
  position: sticky;
  bottom: 0;
  height: var(--ftr-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  background: var(--sunken);
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--border);
}
.ftr a { margin-left: 8px; }
.status { display: inline-flex; align-items: center; gap: 6px; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }

.public-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 16px 48px;
}
.prose-main {
  flex: 1;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 32px 18px 48px;
}
.legal h1 { font-size: 26px; margin: 0 0 8px; text-align: left; }
.legal .lede { text-align: left; margin: 0 0 16px; }
.legal h2 { font-size: 16px; margin: 22px 0 8px; }
.legal p { margin: 0 0 12px; }
.legal ul { margin: 0 0 12px; padding-left: 1.2em; }
.legal li { margin: 4px 0; }
.legal a, .fine a { color: var(--accentFg); text-decoration: underline; }
.legal code { font-size: 12px; }
.card {
  --c: 14px;
  width: min(440px, 100%);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  padding: 28px 28px 22px;
  border-top: 3px solid var(--accent);
}
.card.wide { width: min(560px, 100%); }
.card h1 { text-align: center; font-size: 22px; margin: 0 0 6px; }
.lede { text-align: center; color: var(--muted); margin: 0 0 16px; }
.mode-toggle { display: grid; grid-template-columns: 1fr 1fr; background: var(--sunken); margin-bottom: 8px; }
.mode-toggle button { border: 0; background: transparent; min-height: 36px; font-weight: 600; }
.mode-toggle button[aria-selected="true"] { background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent); }
.hint, .fine { color: var(--muted); font-size: 12px; text-align: center; }
.agent-note { color: var(--accentFg); font-size: 12px; text-align: center; }
.card hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.banner {
  width: min(440px, 100%);
  margin: 0 auto 12px;
  border: 1px solid var(--accent);
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 600;
  background: var(--surface);
}

.form label { display: block; font-weight: 600; margin: 14px 0 6px; }
.form input, .form textarea, .form select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 10px;
  min-height: 40px;
}
.form input[readonly] { background: var(--sunken); color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 220px; gap: 28px; }
.picture-col { text-align: center; }
.pic, .pic.fallback {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin: 12px auto;
  background: var(--sunken);
  display: grid;
  place-items: center;
  font-weight: 700;
  object-fit: cover;
}
.settings { display: grid; grid-template-columns: 260px 1fr; gap: 28px; max-width: 1200px; }
.settings-nav a { display: flex; gap: 8px; align-items: center; padding: 8px 10px; font-weight: 600; }
.settings-nav a.on { background: var(--sunken); box-shadow: inset 3px 0 0 var(--accent); }
.who { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.settings h2 { margin-top: 0; }
.error { color: var(--danger); font-weight: 600; }
.ok { color: var(--ok); font-weight: 600; }
.slug-row { display: flex; border: 1px solid var(--border); background: var(--surface); }
.slug-prefix { background: var(--sunken); padding: 8px 10px; color: var(--muted); white-space: nowrap; }
.slug-row input { border: 0; }
.slug-status { min-height: 1.2em; font-size: 12px; font-weight: 600; }
.slug-status[data-state="ok"] { color: var(--ok); }
.slug-status[data-state="bad"] { color: var(--danger); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.org-create { max-width: 760px; margin: 0 auto; }
.org-create h1 { display: flex; gap: 8px; align-items: center; }
.grid { width: 100%; border-collapse: collapse; margin-top: 16px; }
.grid th, .grid td { border-bottom: 1px solid var(--border); text-align: left; padding: 8px 6px; font-size: 13px; }
.token-once {
  --c: 12px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--accent);
  padding: 12px 14px;
  margin: 12px 0;
}
.token-once code { display: block; overflow-wrap: anywhere; margin: 8px 0; font-weight: 700; }
.form.inline { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px 12px; align-items: end; }
.form.inline label { margin: 0; }
.form.inline .error { grid-column: 1 / -1; }

@media (max-width: 800px) {
  .ftr { height: auto; min-height: var(--ftr-h); flex-wrap: wrap; padding: 4px 8px; }
  :root { --hdr-h: 52px; }
  .hamburger { display: grid; }
  .topnav, .search { display: none; }
  .shell { grid-template-columns: 1fr; padding: 12px; }
  .rail { display: none; min-height: 240px; }
  .shell.nav-open .rail { display: flex; }
  .ph-grid, .settings, .form-grid, .form.inline { grid-template-columns: 1fr; }
  .page-head { flex-wrap: wrap; }
  .page-head h1 { font-size: 22px; }
  .ftr span:first-child { display: none; }
  .btn { min-height: 44px; }
}
