:root {
  --ink: #14201c;
  --muted: #5a6b64;
  --line: #d5ddd8;
  --paper: #f7f5f0;
  --panel: #fffefb;
  --accent: #0f6e56;
  --accent-soft: #d8efe6;
  --rail: #eef2ef;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
.desk-body {
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
.desk-body:has(.shell) {
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
}
button.primary,
a.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
a.primary {
  border: 1px solid var(--accent);
  text-decoration: none;
}
a.primary:hover {
  color: #fff;
  filter: brightness(0.95);
}
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--ink); background: var(--rail); }
a.ghost {
  display: inline-block;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  color: var(--muted);
  text-decoration: none;
}
a.ghost:hover { color: var(--ink); background: var(--rail); }
.mono { font-family: "IBM Plex Mono", monospace; font-size: 0.8rem; }
.muted { color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.rail {
  background: linear-gradient(180deg, #e8efea 0%, var(--rail) 40%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 1rem 0.75rem;
  min-height: 0;
  overflow: hidden;
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  padding-left: max(0.75rem, env(safe-area-inset-left));
}
.rail-backdrop {
  display: none;
}
.rail-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  flex-shrink: 0;
  border-radius: 8px;
}
.rail-toggle svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  padding: 0 0.5rem 0.35rem;
  letter-spacing: -0.02em;
}
.rail-meta {
  padding: 0 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.threads {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  -webkit-overflow-scrolling: touch;
}
.thread-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  border-radius: 8px;
}
.thread-row:hover,
.thread-row:focus-within,
.thread-row.is-menu-open {
  background: rgba(255,255,255,.55);
}
.thread-row.is-active {
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
}
.thread {
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 0.65rem 0.5rem 0.65rem 0.75rem;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  display: block;
}
.thread:hover { background: transparent; }
.thread.active { background: transparent; box-shadow: none; }
.thread .title {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread .sub { font-size: 0.75rem; color: var(--muted); margin-top: 0.15rem; }
.thread-actions {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  padding-right: 0.35rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}
.thread-row:hover .thread-actions,
.thread-row:focus-within .thread-actions,
.thread-row.is-menu-open .thread-actions,
.thread-row.is-active .thread-actions {
  opacity: 1;
  pointer-events: auto;
}
@media (pointer: coarse) {
  .thread-actions {
    opacity: 1;
    pointer-events: auto;
  }
}
.thread-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.thread-action:hover,
.thread-action:focus-visible {
  color: var(--ink);
  background: var(--rail);
}
.thread-action.danger:hover,
.thread-action.danger:focus-visible {
  color: #9b1c1c;
  background: #fceeed;
}
.thread-action svg {
  display: block;
  width: 0.95rem;
  height: 0.95rem;
}
.thread-menu {
  position: fixed;
  z-index: 80;
  min-width: 10.5rem;
  margin: 0;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(20, 32, 28, 0.12);
  display: none;
}
.thread-menu.is-open { display: block; }
.thread-menu button {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 0.5rem 0.65rem;
  text-align: left;
  color: var(--ink);
  font-size: 0.88rem;
}
.thread-menu button:hover,
.thread-menu button:focus-visible {
  background: var(--rail);
}
.thread-menu button.danger { color: #9b1c1c; }
.thread-menu button.danger:hover,
.thread-menu button.danger:focus-visible { background: #fceeed; }
.thread-menu button[hidden] { display: none; }
.thread-menu .sep {
  height: 1px;
  margin: 0.25rem 0.35rem;
  background: var(--line);
}
.thread-menu svg {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
}
.share-dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(20, 32, 28, 0.14);
  width: min(20rem, calc(100vw - 2rem));
}
.share-dialog::backdrop {
  background: rgba(20, 32, 28, 0.35);
}
.share-dialog-body {
  padding: 1.1rem 1.15rem 1.15rem;
}
.share-dialog h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  letter-spacing: -0.02em;
}
.share-dialog p {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.share-dialog select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  background: #fff;
  margin-bottom: 0.85rem;
}
.share-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
}
.rail-foot {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--panel);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  flex-shrink: 0;
  background: var(--panel);
  z-index: 1;
}
.topbar h1 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
  min-width: 10rem;
}
.topbar form.inline { display: flex; gap: 0.4rem; align-items: center; }
.topbar input[type="url"], .topbar input[type="text"], .topbar select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  background: var(--paper);
  min-width: 12rem;
}
.messages {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.5rem 1.25rem 1rem;
  -webkit-overflow-scrolling: touch;
}
.msg { max-width: 42rem; margin: 0 auto 1.25rem; line-height: 1.55; }
.msg .who {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.msg.agent .who { color: var(--accent); }
.msg .skill-tag {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.35rem;
  text-transform: none;
  letter-spacing: 0;
}
.composer-wrap {
  border-top: 1px solid var(--line);
  padding: 0.85rem 1.25rem 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #fbfaf7, var(--panel));
  flex-shrink: 0;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-width: 42rem;
  margin: 0 auto 0.65rem;
}
.chip {
  position: relative;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  background: var(--paper);
}
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chip .tip {
  display: none;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: #1a2420;
  color: #e8f0eb;
  font-size: 0.72rem;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 5;
}
.chip:hover .tip, .chip:focus-visible .tip { display: block; }
.composer {
  display: flex;
  gap: 0.5rem;
  max-width: 42rem;
  margin: 0 auto;
  align-items: flex-end;
}
.composer textarea {
  flex: 1;
  min-height: 2.75rem;
  max-height: 10rem;
  resize: none;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: #fff;
  line-height: 1.45;
  field-sizing: content;
}
.composer textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}
.composer-hint {
  max-width: 42rem;
  margin: 0.45rem auto 0;
  font-size: 0.72rem;
}
.composer-error {
  max-width: 42rem;
  margin: 0.45rem auto 0;
  color: #9b1c1c;
  font-size: 0.8rem;
}
.desk-blank {
  max-width: 28rem;
  margin: 4rem auto;
  text-align: center;
  padding: 2rem 1.25rem;
}
.desk-blank h2 {
  margin: 0 0 0.45rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.desk-blank p {
  margin: 0 0 1.25rem;
  line-height: 1.5;
}
.empty {
  max-width: 28rem;
  margin: 4rem auto;
  text-align: center;
  padding: 2rem;
}
.empty h1 { font-size: 1.6rem; letter-spacing: -0.02em; margin: 0 0 0.5rem; }
.status-banner {
  max-width: 42rem;
  margin: 0 auto 1rem;
  padding: 0.55rem 0.75rem;
  background: var(--accent-soft);
  border-radius: 8px;
  font-size: 0.85rem;
}
.run-pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
}
.msg .body.md > *:first-child { margin-top: 0; }
.msg .body.md > *:last-child { margin-bottom: 0; }
.msg .body.md p { margin: 0 0 0.75rem; }
.msg .body.md h1,
.msg .body.md h2,
.msg .body.md h3,
.msg .body.md h4 {
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 1rem 0 0.45rem;
  line-height: 1.25;
}
.msg .body.md h1 { font-size: 1.25rem; }
.msg .body.md h2 { font-size: 1.1rem; }
.msg .body.md h3 { font-size: 1rem; }
.msg .body.md ul,
.msg .body.md ol { margin: 0 0 0.75rem; padding-left: 1.25rem; }
.msg .body.md li { margin: 0.2rem 0; }
.msg .body.md a { color: var(--accent); }
.msg .body.md blockquote {
  margin: 0 0 0.75rem;
  padding: 0.15rem 0 0.15rem 0.75rem;
  border-left: 1px solid var(--line);
  color: var(--muted);
}
.msg .body.md code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85em;
  background: var(--rail);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}
.msg .body.md pre {
  margin: 0 0 0.75rem;
  padding: 0.75rem 0.85rem;
  background: #14201c;
  color: #e8f0eb;
  border-radius: 8px;
  overflow: auto;
}
.msg .body.md pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 0.8rem;
}
.msg .body.md table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}
.msg .body.md th,
.msg .body.md td {
  border: 1px solid var(--line);
  padding: 0.35rem 0.5rem;
  text-align: left;
}
.msg .body.md hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1rem 0;
}

.file-cards {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.85rem;
}
.file-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}
.file-card > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.75rem;
  padding: 0.55rem 0.75rem;
  background: var(--rail);
  user-select: none;
}
.file-card > summary::-webkit-details-marker { display: none; }
.file-card > summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 0.75rem;
  width: 0.75rem;
}
.file-card[open] > summary::before { content: "▾"; }
.file-card-label {
  font-weight: 600;
  font-size: 0.88rem;
}
.file-card-path {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
  background: transparent;
  padding: 0;
}
.file-card-body {
  padding: 0.75rem 0.85rem 0.85rem;
  border-top: 1px solid var(--line);
  max-height: 22rem;
  overflow: auto;
}

.ask-block {
  margin-top: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.ask-title {
  padding: 0.55rem 0.85rem;
  background: var(--rail);
  border-bottom: 1px solid var(--line);
  font-weight: 650;
  font-size: 0.88rem;
}
.ask-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.85rem;
}
.ask-question {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.ask-q-header {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.ask-q-prompt {
  float: none;
  padding: 0;
  font-weight: 600;
  font-size: 0.95rem;
}
.ask-type-hint {
  margin: 0.2rem 0 0.45rem;
  font-size: 0.72rem;
}
.ask-options {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.ask-option {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
}
.ask-option:hover { border-color: #b7c7bf; }
.ask-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.ask-option input {
  margin-top: 0.15rem;
  accent-color: var(--accent);
}
.ask-option-copy { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.ask-option-label { font-size: 0.9rem; line-height: 1.35; }
.ask-opt-desc { font-size: 0.75rem; color: var(--muted); }
.ask-recommended {
  margin-left: 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.ask-free {
  display: block;
  margin-top: 0.45rem;
}
.ask-free input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  background: #fff;
}
.ask-free input[type="text"]:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}
.ask-actions {
  padding: 0 0.85rem 0.85rem;
  display: flex;
  justify-content: flex-end;
}
.ask-block.is-readonly .ask-actions { display: none; }
.ask-option.is-static { cursor: default; }

.msg.working .body {
  color: var(--muted);
  font-style: italic;
}
.msg.working .thinking {
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: var(--rail);
  border-radius: 8px;
  border: 1px solid var(--line);
  font-style: normal;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink);
  white-space: pre-wrap;
  max-height: 14rem;
  overflow: auto;
}
.msg.working .activity {
  margin-top: 0.5rem;
  font-style: normal;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}
.msg.working .activity li { margin: 0.15rem 0; }
.stream-cursor::after {
  content: "▋";
  margin-left: 0.15rem;
  animation: blink 1s step-end infinite;
  color: var(--accent);
  font-style: normal;
}
@keyframes blink { 50% { opacity: 0; } }
.composer.is-busy textarea,
.composer.is-busy button.primary {
  opacity: 0.55;
  pointer-events: none;
}
@media (max-width: 800px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .rail-toggle { display: inline-flex; }
  .rail-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(20, 32, 28, 0.4);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 200ms ease, visibility 200ms ease;
  }
  .shell.rail-open .rail-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .rail {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(18rem, 86vw);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
  }
  .shell.rail-open .rail {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(20, 32, 28, 0.14);
  }
  .topbar {
    padding: 0.65rem 0.85rem;
    gap: 0.5rem;
  }
  .topbar h1 {
    font-size: 0.95rem;
    min-width: 0;
    flex: 1 1 auto;
  }
  .topbar form.inline {
    flex-wrap: wrap;
    width: 100%;
  }
  .topbar input[type="url"],
  .topbar input[type="text"],
  .topbar select {
    min-width: 0;
    flex: 1 1 8rem;
    width: 100%;
  }
  .messages {
    padding: 1rem 0.85rem 0.75rem;
  }
  .composer-wrap {
    padding: 0.75rem 0.85rem;
    padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
  }
  .composer {
    gap: 0.4rem;
  }
  .composer textarea {
    min-height: 2.75rem;
    font-size: 1rem; /* avoid iOS zoom on focus */
  }
  .composer button.primary {
    min-height: 2.75rem;
    padding-inline: 1rem;
  }
  .chip {
    min-height: 2.25rem;
    padding: 0.4rem 0.85rem;
  }
  .thread {
    padding: 0.75rem 0.85rem;
    min-height: 2.75rem;
  }
}

@media (pointer: coarse) {
  button,
  a.ghost,
  a.primary,
  .chip,
  .ask-option {
    min-height: 2.5rem;
  }
  .ask-option {
    padding: 0.7rem 0.75rem;
  }
}

/* ——— Shared forms / pages (auth, profile, invites, github) ——— */
a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--ink); }
button.danger {
  background: #fff;
  border-color: #c45c4a;
  color: #9b1c1c;
  font-weight: 600;
}
button.danger:hover { background: #fceeed; }
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="url"],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  background: #fff;
  line-height: 1.4;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}
.field-error {
  margin: 0;
  padding: 0;
  list-style: none;
  color: #9b1c1c;
  font-size: 0.8rem;
}
.field-hint { font-size: 0.8rem; color: var(--muted); }
.field-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.field-check input { accent-color: var(--accent); }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.5rem;
}
.form-actions .spacer { flex: 1; min-width: 0.5rem; }
.form-link {
  font-size: 0.85rem;
  color: var(--muted);
}
.form-link:hover { color: var(--ink); }

.banner {
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.88rem;
  margin-bottom: 1rem;
  background: var(--accent-soft);
  color: var(--ink);
}
.banner.warn {
  background: #f5efe0;
  color: #5c4a1f;
}
.banner.error {
  background: #fceeed;
  color: #9b1c1c;
}
.banner code,
.page-copy code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85em;
  background: rgba(20, 32, 28, 0.06);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

/* Guest (login / register / password) */
.guest-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, #d8efe6 0%, transparent 55%),
    linear-gradient(180deg, #e8efea 0%, var(--paper) 42%, #f3f0e8 100%);
}
.guest-brand {
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
  color: var(--ink);
  text-decoration: none;
}
.guest-brand:hover { color: var(--ink); }
.guest-sub {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
  max-width: 22rem;
}
.guest-panel {
  width: 100%;
  max-width: 24rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem 1.35rem 1.35rem;
  box-shadow: 0 12px 40px rgba(20, 32, 28, 0.06);
  animation: guest-in 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.guest-panel h1 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.guest-lead {
  margin: 0 0 1.25rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}
@keyframes guest-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Settings / secondary pages */
.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, #e8efea 0%, var(--paper) 28%, var(--paper) 100%);
}
.page-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 251, 0.85);
  backdrop-filter: blur(8px);
}
.page-topbar .brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
  padding: 0;
}
.page-topbar .brand:hover { color: var(--ink); }
.page-topbar h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.page-topbar-nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}
.page-topbar-nav a,
.page-topbar-nav button {
  font-size: 0.85rem;
}
.page-main {
  width: 100%;
  max-width: 36rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 3.5rem;
  animation: guest-in 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.page-intro {
  margin-bottom: 1.75rem;
}
.page-intro h1 {
  margin: 0 0 0.4rem;
  font-size: 1.65rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.page-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 38ch;
}
.page-section {
  padding: 1.35rem 0;
  border-top: 1px solid var(--line);
}
.page-section:first-of-type { border-top: 0; padding-top: 0; }
.page-section h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.page-section .page-copy {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}
.invite-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.invite-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  font-size: 0.85rem;
}
.invite-list .token {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  word-break: break-all;
  color: var(--ink);
}
.invite-url {
  display: block;
  margin-top: 0.5rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  word-break: break-all;
  padding: 0.65rem 0.75rem;
  background: var(--rail);
  border-radius: 8px;
  color: var(--ink);
}
.confirm-box {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.confirm-box[hidden] { display: none; }
.confirm-box h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}
@media (max-width: 560px) {
  .page-topbar {
    padding: 0.75rem 0.85rem;
    padding-top: max(0.75rem, env(safe-area-inset-top));
  }
  .page-topbar-nav { width: 100%; margin-left: 0; }
  .page-main {
    padding: 1.5rem 0.85rem 2.5rem;
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
  }
  .page-intro h1 { font-size: 1.4rem; }
  .guest-shell {
    padding: 1.5rem 0.85rem;
    padding-top: max(1.5rem, env(safe-area-inset-top));
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }
  .guest-panel { padding: 1.25rem 1.1rem; }
}
