/* Glampfire app pages (everything signed in except the chat): content sits on the
   canvas in white rounded cards, with the page title in the header. */
body.app:not(.sidebar) {
  .app-card { display: none; }

  #nav {
    border: 0;
    min-block-size: 68px;
    padding: 14px 28px 6px;

    /* White circular icon buttons */
    .btn:not(dialog *):not(.nav-button) {
      --btn-background: var(--gf-surface);
      --btn-border-color: transparent;
      --btn-size: 40px;

      border-radius: 999px;
      box-shadow: var(--gf-shadow-card);

      &:hover { --btn-background: var(--gf-hover); }
    }
  }

  #main-content { overflow-y: auto; }
}

#nav .flex-item-justify-start { order: -1; }
#nav .flex-item-justify-end { margin-inline-start: auto; order: 1; }

.page-title {
  flex: 1;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0;
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-subtitle {
  color: var(--gf-ink-subtle);
  display: block;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
}

/* Page column */
.page {
  display: grid;
  gap: 16px;
  inline-size: 100%;
  margin-inline: auto;
  max-inline-size: 760px;
  padding: 8px 28px 64px;

  @media (max-width: 100ch) { padding: 4px 14px 112px; }
}

.page--wide { max-inline-size: 1080px; }

/* Cards: radius 24 = 16 inner + 8 gap; inner groups use 16 */
.card {
  background-color: var(--gf-surface);
  border-radius: 24px;
  box-shadow: var(--gf-shadow-card);
  min-inline-size: 0;
  padding: 24px;

  @media (max-width: 100ch) { padding: 18px; border-radius: 20px; }
}

.card--danger {
  box-shadow: var(--gf-shadow-card), inset 0 0 0 1px color-mix(in oklch, var(--gf-negative) 22%, transparent);
}

.card__header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-block-end: 18px;

  h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
  p { color: var(--gf-ink-subtle); font-size: 14px; margin: 4px 0 0; }
}

.card__actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-block-start: 20px;
}

/* Hero: avatar/logo, name and a line of context */
.hero {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;

  h1, h2 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin: 10px 0 0; }
  p { color: var(--gf-ink-subtle); margin: 0; max-inline-size: 46ch; }
}

.hero__image {
  block-size: 96px;
  border-radius: 50%;
  inline-size: 96px;
  object-fit: cover;
  outline: 1px solid oklch(0% 0 0 / 0.08);
  outline-offset: -1px;
}

.hero__image--square { border-radius: 24px; }

/* Avatar/logo with an upload badge */
.avatar-editor {
  display: inline-grid;
  position: relative;

  label {
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    position: relative;

    &:focus-within { outline: 2px solid var(--gf-mention); outline-offset: 3px; }
  }

  input[type="file"] {
    block-size: 100%;
    cursor: pointer;
    inline-size: 100%;
    inset: 0;
    opacity: 0;
    position: absolute;
  }
}

.avatar-editor--square label { border-radius: 24px; }

.avatar-editor__badge {
  align-items: center;
  background-color: var(--gf-primary);
  block-size: 32px;
  border: 3px solid var(--gf-surface);
  border-radius: 50%;
  color: var(--gf-on-primary);
  display: flex;
  inline-size: 32px;
  inset: auto -2px -2px auto;
  justify-content: center;
  pointer-events: none;
  position: absolute;

  .icon { block-size: 15px; inline-size: 15px; }
  img { block-size: 15px; filter: invert(1); inline-size: 15px; }

  @media (prefers-color-scheme: dark) { img { filter: none; } }
}

.avatar-editor:hover .hero__image { filter: brightness(0.92); }

/* Forms */
.form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
  min-inline-size: 0;

  textarea.input { line-height: 1.5; min-block-size: 96px; }
}

.field__label {
  align-items: center;
  color: var(--gf-ink-subtle);
  display: flex;
  font-size: 13px;
  font-weight: 550;
  gap: 6px;
  justify-content: space-between;
}

.field__hint { color: var(--gf-ink-faint); font-size: 13px; }

/* Campfire's translate popover, as a quiet icon at the end of a label */
.field__label details > summary.btn {
  --btn-background: transparent;
  --btn-border-color: transparent;
  --btn-size: 26px;

  box-shadow: none;

  img { block-size: 15px; inline-size: 15px; opacity: 0.5; }
}

/* Setting rows: text on the left, a control on the right */
.setting {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-block-size: 52px;

  & + & { border-block-start: 1px solid var(--gf-border); }

  form { margin: 0; }
}

.setting__text {
  display: grid;
  gap: 2px;
  min-inline-size: 0;

  strong { font-size: 15px; font-weight: 600; }
  span { color: var(--gf-ink-subtle); font-size: 13.5px; }
}

/* Lists of people, rooms, bots, devices */
.list {
  display: flex;
  flex-direction: column;
  list-style: none;
  margin: 0;
  padding: 0;
}

.list__item {
  align-items: center;
  display: flex;
  gap: 12px;
  margin: 0;
  min-block-size: 56px;
  padding-block: 8px;

  & + & { border-block-start: 1px solid var(--gf-border); }

  &.banned { opacity: 0.55; }

  form { margin: 0; }
}

.list__avatar {
  block-size: 36px;
  border-radius: 50%;
  flex: none;
  inline-size: 36px;
  object-fit: cover;
  outline: 1px solid oklch(0% 0 0 / 0.08);
  outline-offset: -1px;
}

.list__text {
  display: grid;
  flex: 1;
  gap: 1px;
  min-inline-size: 0;

  > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

.list__title { color: var(--gf-ink); font-weight: 600; text-decoration: none; }
a.list__title:hover { text-decoration: underline; }
.list__meta { color: var(--gf-ink-subtle); font-size: 13px; }

.list__actions {
  align-items: center;
  display: flex;
  flex: none;
  gap: 6px;

  .btn { --btn-size: 34px; }
}

/* Small pills */
.badge {
  align-items: center;
  background-color: var(--gf-hover);
  border: 1px solid var(--gf-border);
  border-radius: 999px;
  color: var(--gf-ink-subtle);
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  padding: 3px 10px;
  white-space: nowrap;
}

.badge--live {
  background-color: color-mix(in oklch, var(--gf-positive) 14%, var(--gf-surface));
  border-color: transparent;
  color: color-mix(in oklch, var(--gf-positive) 70%, var(--gf-ink));

  &::before {
    background-color: var(--gf-positive);
    block-size: 7px;
    border-radius: 50%;
    content: "";
    inline-size: 7px;
  }
}

/* Overlapping avatars */
.avatar-stack {
  align-items: center;
  display: flex;
  padding-inline-start: 8px;

  > * {
    align-items: center;
    background-color: var(--gf-selected);
    block-size: 30px;
    border-radius: 50%;
    display: inline-flex;
    font-size: 12px;
    font-weight: 650;
    inline-size: 30px;
    justify-content: center;
    margin-inline-start: -8px;
    object-fit: cover;
    outline: 2px solid var(--gf-surface);
  }

  .avatar-stack__more {
    background-color: var(--gf-ink);
    color: var(--gf-on-primary);
  }
}

/* Inline copy field (invite and sign-in links) */
.copy-field {
  align-items: center;
  display: flex;
  gap: 8px;

  .input { flex: 1; font-size: 14px; min-inline-size: 0; text-overflow: ellipsis; }
}

/* Mobile: the rail becomes a floating bottom navigation on app pages */
@media (max-width: 100ch) {
  body.app:not(.sidebar) .rail {
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    background-color: color-mix(in oklch, var(--gf-surface) 86%, transparent);
    block-size: 64px;
    border-radius: 999px;
    box-shadow: var(--gf-shadow-pop);
    flex-direction: row;
    gap: 6px;
    inline-size: auto;
    inset: auto 16px max(14px, env(safe-area-inset-bottom)) 16px;
    justify-content: space-around;
    padding: 0 12px;
    translate: none;

    .rail__logo { display: none; }
    .rail__group, .rail__group--end { flex-direction: row; gap: 6px; margin: 0; }
  }

  body.app:not(.sidebar) #nav { padding-inline: 16px; }
}

/* Buttons with an icon and a label */
.btn--labeled,
.btn:has(> .icon) {
  --btn-padding: 0 16px 0 14px;

  gap: 8px;

  .icon { block-size: 18px; inline-size: 18px; }
}

/* Account identity: logo, name, remove logo */
.account-identity {
  align-items: center;
  display: flex;
  gap: 18px;

  .account-identity__name { flex: 1; }
  .account-identity__title { font-size: 22px; font-weight: 650; margin: 0; }
  .hero__image { block-size: 72px; inline-size: 72px; }
}

/* Setting rows that navigate */
.setting--link {
  border-radius: 12px;
  color: inherit;
  margin-inline: -10px;
  padding-inline: 10px;
  text-decoration: none;

  .icon { color: var(--gf-ink-faint); flex: none; }
  &:hover { background-color: var(--gf-hover); }
  &:hover + .setting, & + .setting--link { border-color: transparent; }
}

/* Admin crown toggle in people lists */
.role-toggle {
  img { opacity: 0.35; }
  &:has(input:checked) { --btn-background: var(--gf-brand-soft); --btn-border-color: transparent; }
  &:has(input:checked) img { opacity: 1; }
}

/* Member pickers (room and meeting forms) */
.member-picker {
  background-color: var(--gf-hover);
  border-radius: 16px;
  max-block-size: 420px;
  overflow-y: auto;
  padding: 4px 14px;

  .list__item + .list__item { border-color: var(--gf-border); }
}

.member-picker__filter { margin: 10px 0 4px; }

.member-picker__divider {
  border-block-start: 2px solid var(--gf-border-strong);
  list-style: none;
  margin-block: 4px;
}

.access-choice {
  background-color: var(--gf-hover);
  border-radius: 16px;
  padding: 8px 14px;
}

/* Chat bots: commands per room */
.bot-room {
  background-color: var(--gf-hover);
  border-radius: 16px;
  display: grid;
  gap: 8px;
  margin-block-start: 12px;
  padding: 12px 14px;

  .copy-field .input { font-size: 12.5px; }
}

.bot-room__name { align-items: center; display: flex; gap: 8px; }
.bot-room__kind { color: var(--gf-ink-faint); display: inline-flex; .icon { block-size: 18px; inline-size: 18px; } }

/* Search */
.search-bar {
  align-items: center;
  display: flex;
  flex: none;
  gap: 10px;
  padding: 18px 24px 6px;

  @media (max-width: 100ch) { padding: 12px 14px 6px; }
}

.search-bar__field {
  --input-border-radius: 999px;
  --input-padding: 0 8px 0 16px;

  color: var(--gf-ink-faint);
  display: flex;
  flex: 1;
  gap: 10px;
  min-block-size: 48px;

  .icon { block-size: 18px; flex: none; inline-size: 18px; }
  .input { font-size: 16px; padding: 0; }

  .searches__reset {
    align-items: center;
    border-radius: 50%;
    color: var(--gf-ink-subtle);
    display: inline-flex;
    flex: none;
    block-size: 30px;
    inline-size: 30px;
    justify-content: center;

    &:hover { background-color: var(--gf-hover); }
  }
}

.search-bar .btn { min-block-size: 48px; --btn-padding: 0 22px; }

.search-summary {
  color: var(--gf-ink-subtle);
  flex: none;
  font-size: 13.5px;
  margin: 4px 24px 0;
}

.search-empty { color: var(--gf-ink-subtle); margin: 8px 0 0; text-align: center; }

.searches .message__room a { color: var(--gf-ink-subtle); }

/* Meetings home */
.meetings-home { gap: 22px; }

.meet-hero {
  background:
    radial-gradient(120% 90% at 100% 0%, oklch(68% 0.2 40 / 0.55), transparent 60%),
    radial-gradient(80% 70% at 85% 100%, oklch(70% 0.16 330 / 0.28), transparent 65%),
    linear-gradient(135deg, oklch(24% 0.03 265), oklch(19% 0.02 265));
  border-radius: 28px;
  color: white;
  display: grid;
  gap: 10px;
  overflow: hidden;
  padding: 32px;
  position: relative;

  /* The flame, large and faint */
  &::after {
    background: url("/assets/glampfire-icon-96563876.svg") no-repeat center / contain;
    block-size: 260px;
    content: "";
    inline-size: 260px;
    inset: auto -40px -60px auto;
    opacity: 0.14;
    position: absolute;
    rotate: -8deg;
  }

  h2 { font-size: 34px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; margin: 0; max-inline-size: 16ch; position: relative; z-index: 1; }
  h2 span { color: oklch(78% 0.15 40); }
  p { color: oklch(100% 0 0 / 0.72); margin: 0; max-inline-size: 46ch; position: relative; z-index: 1; }

  @media (max-width: 100ch) { padding: 24px; h2 { font-size: 28px; } }
}

.meet-hero__eyebrow { color: oklch(100% 0 0 / 0.65) !important; font-weight: 550; }

.meet-hero__badge {
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  background-color: oklch(100% 0 0 / 0.14);
  color: white;
  justify-self: start;
}

.meet-hero__row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-block-start: 10px;
  position: relative;
  z-index: 1;
}

.meet-hero__cta {
  align-items: center;
  background-color: white;
  border-radius: 999px;
  color: oklch(21.5% 0.018 265);
  display: inline-flex;
  font-weight: 650;
  gap: 12px;
  padding: 6px 22px 6px 6px;
  text-decoration: none;
  transition: scale 100ms var(--gf-ease-out);

  &:active { scale: 0.97; }
  &:hover { background-color: oklch(97% 0.005 265); }
}

.meet-hero__cta-icon {
  align-items: center;
  background-color: oklch(21.5% 0.018 265);
  block-size: 40px;
  border-radius: 50%;
  color: white;
  display: inline-flex;
  inline-size: 40px;
  justify-content: center;

  .icon { block-size: 18px; inline-size: 18px; }
}

.avatar-stack--hero > * { outline-color: oklch(22% 0.02 265); }

.stat-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat {
  background-color: var(--gf-surface);
  border-radius: 20px;
  box-shadow: var(--gf-shadow-card);
  display: grid;
  gap: 2px 10px;
  grid-template-columns: auto 1fr;
  padding: 14px 16px;

  strong { font-size: 20px; font-variant-numeric: tabular-nums; font-weight: 650; }
  > span:last-child { color: var(--gf-ink-subtle); font-size: 13.5px; grid-column: 1 / -1; }
}

.stat__icon {
  align-items: center;
  color: var(--gf-ink-subtle);
  display: inline-flex;

  .icon { block-size: 20px; inline-size: 20px; }
}

.stat__icon--live { color: var(--gf-brand); }

.section-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-block-end: 12px;

  h2 { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
}

.live-list { display: grid; gap: 10px; }

.live-item {
  align-items: center;
  background-color: var(--gf-surface);
  border-radius: 20px;
  box-shadow: var(--gf-shadow-card);
  color: inherit;
  display: flex;
  gap: 14px;
  padding: 12px 14px 12px 18px;
  text-decoration: none;

  &:hover { box-shadow: var(--gf-shadow-pop); }
}

.meetings-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.meeting-card {
  --tone: oklch(95.5% 0.03 30);

  background-color: var(--tone);
  border-radius: 24px;
  color: var(--gf-ink);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-block-size: 220px;
  padding: 20px;

  &:target { outline: 2px solid var(--gf-ink); outline-offset: 2px; }

  @media (prefers-color-scheme: dark) { --tone: oklch(27% 0.035 30); }
}

.meeting-card--tone-1 { --tone: oklch(95.5% 0.028 250); @media (prefers-color-scheme: dark) { --tone: oklch(27% 0.04 250); } }
.meeting-card--tone-2 { --tone: oklch(96% 0.035 150); @media (prefers-color-scheme: dark) { --tone: oklch(27% 0.035 150); } }
.meeting-card--tone-3 { --tone: oklch(95.5% 0.03 300); @media (prefers-color-scheme: dark) { --tone: oklch(27% 0.035 300); } }

.meeting-card__top { align-items: center; display: flex; justify-content: space-between; }

.meeting-card__icon {
  align-items: center;
  background-color: oklch(100% 0 0 / 0.7);
  block-size: 40px;
  border-radius: 50%;
  display: inline-flex;
  inline-size: 40px;
  justify-content: center;

  .icon { block-size: 19px; inline-size: 19px; }

  @media (prefers-color-scheme: dark) { background-color: oklch(100% 0 0 / 0.1); }
}

.meeting-card__title { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; margin: 6px 0 0; overflow-wrap: anywhere; }
.meeting-card__meta { color: var(--gf-ink-subtle); font-size: 13.5px; margin: 0; }

.meeting-card .avatar-stack > * { outline-color: var(--tone); }

.meeting-card__actions {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-block-start: auto;

  .btn--reversed { --btn-padding: 0 22px; margin-inline-end: auto; }
  .btn:not(.btn--reversed) { --btn-background: oklch(100% 0 0 / 0.7); --btn-border-color: transparent; box-shadow: none; }

  @media (prefers-color-scheme: dark) { .btn:not(.btn--reversed) { --btn-background: oklch(100% 0 0 / 0.1); } }
}

.meeting-card--new {
  align-items: flex-start;
  background-color: transparent;
  border: 2px dashed var(--gf-border-strong);
  justify-content: center;
  text-decoration: none;

  strong { font-size: 16px; }
  span:last-child { color: var(--gf-ink-subtle); font-size: 13.5px; }
  .meeting-card__icon { background-color: var(--gf-surface); box-shadow: var(--gf-shadow-card); }
  &:hover { background-color: oklch(100% 0 0 / 0.5); }
}

.empty-state {
  align-items: center;
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 40px 24px;
  text-align: center;

  h3 { font-size: 17px; margin: 4px 0 0; }
  p { color: var(--gf-ink-subtle); margin: 0 0 8px; max-inline-size: 40ch; }
}

/* Account footer credits */
body.app:not(.sidebar) #footer {
  color: var(--gf-ink-faint);
  font-size: 13px;
  padding-block-end: 32px;
}
