:root {
  color-scheme: light dark;

  /* Palette: teal #026670, mint #9FEDD7, cream #FEF9C7, yellow #FCE181, stone #EDEAE5. */
  --color-bg: #edeae5;
  --color-surface: #fffdf8;
  --color-surface-alt: #f6f3ee;
  --color-text: #1e2b2d;
  --color-muted: #5c6869;
  --color-border: #dcd6cd;
  --color-accent: #026670;
  --color-mention: #0866ff;
  --color-mention-bg: #dbe7ff;
  --color-accent-hover: #01535b;
  --color-on-accent: #ffffff;
  --color-create: #fce181;
  --color-create-hover: #f9d65c;
  --color-on-create: #3a2f00;
  --color-secondary: #e4e6eb;
  --color-secondary-hover: #d8dadf;
  --color-highlight: #fef9c7;
  --color-topbar: #fce181;
  --color-topbar-border: #e9c95a;
  --color-topbar-brand: #026670;
  --color-error: #c4302b;
  --color-error-bg: #fdecea;
  --color-success: #026670;
  --color-success-bg: #e3f8f1;
  --color-focus: rgba(2, 102, 112, 0.35);
  --flame-l: 80%;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;

  --radius: 8px;
  --radius-small: 6px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.06);
  --topbar-height: 3.5rem;
  --width-auth: 24rem;
  --width-page: 42rem;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --font-size-small: 0.875rem;
  --font-size-input: 1.0625rem;
  --font-size-title: 1.5rem;
  --font-size-brand: 1.75rem;
}

/* Dark: by the system unless Settings > Appearance chose a theme (index.html sets
   data-theme on the root). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0a0f10;
    --color-surface: #243134;
    --color-surface-alt: #2f3e41;
    --color-text: #eef0ec;
    --color-muted: #b0bcba;
    --color-border: #3e4e51;
    --color-accent: #9fedd7;
    --color-mention: #6cb2ff;
    --color-mention-bg: #1d3a63;
    --color-accent-hover: #bdf3e3;
    --color-on-accent: #0e1a1b;
    --color-create: #fce181;
    --color-create-hover: #fde99f;
    --color-on-create: #3a2f00;
    --color-secondary: #3a4547;
    --color-secondary-hover: #4a5658;
    --color-highlight: #3a3620;
    --color-topbar: #3a3317;
    --color-topbar-border: #4d4420;
    --color-topbar-brand: #fce181;
    --color-error: #f0726c;
    --color-error-bg: #3a2222;
    --color-success: #9fedd7;
    --color-success-bg: #1a3330;
    --color-focus: rgba(159, 237, 215, 0.45);
    --flame-l: 30%;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  --color-bg: #0a0f10;
  --color-surface: #243134;
  --color-surface-alt: #2f3e41;
  --color-text: #eef0ec;
  --color-muted: #b0bcba;
  --color-border: #3e4e51;
  --color-accent: #9fedd7;
  --color-mention: #6cb2ff;
  --color-mention-bg: #1d3a63;
  --color-accent-hover: #bdf3e3;
  --color-on-accent: #0e1a1b;
  --color-create: #fce181;
  --color-create-hover: #fde99f;
  --color-on-create: #3a2f00;
  --color-secondary: #3a4547;
  --color-secondary-hover: #4a5658;
  --color-highlight: #3a3620;
  --color-topbar: #3a3317;
  --color-topbar-border: #4d4420;
  --color-topbar-brand: #fce181;
  --color-error: #f0726c;
  --color-error-bg: #3a2222;
  --color-success: #9fedd7;
  --color-success-bg: #1a3330;
  --color-focus: rgba(159, 237, 215, 0.45);
  --flame-l: 30%;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* Settings > Appearance: text size scales every rem; width is the page column. */
:root[data-text-size="small"] { font-size: 87.5%; }
:root[data-text-size="large"] { font-size: 112.5%; }
:root[data-text-size="larger"] { font-size: 125%; }
:root[data-width="narrow"] { --width-page: 36rem; }
:root[data-width="wide"] { --width-page: 52rem; }
:root[data-width="wider"] { --width-page: 64rem; }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.5;
}

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

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--topbar-height);
  padding: var(--space-1) var(--space-4);
  background: var(--color-topbar);
  border-bottom: 1px solid var(--color-topbar-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.topbar-brand {
  color: var(--color-topbar-brand);
  font-size: var(--font-size-brand);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.topbar-brand:hover { text-decoration: none; }

.topbar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.topbar-name { font-weight: 600; }

.topbar-link { color: var(--color-text); font-weight: 500; }

/* Main and footer */

.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--width-page);
  margin: 0 auto;
  padding: var(--space-5) var(--space-3);
}

.site-footer {
  padding: var(--space-3) var(--space-4);
  color: var(--color-muted);
  font-size: var(--font-size-small);
  text-align: center;
}

.build-info {
  margin: 0;
  font-family: var(--font-mono);
}

.build-info.error { color: var(--color-error); }

.page-title {
  margin: 0 0 var(--space-3);
  font-size: var(--font-size-title);
}

.muted { color: var(--color-muted); }
.center { text-align: center; }

.notice {
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-small);
  background: var(--color-error-bg);
  color: var(--color-error);
}

/* Cards */

.card {
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.card-title {
  margin: 0 0 var(--space-3);
  font-size: var(--font-size-title);
  font-weight: 600;
}

h2.card-title { font-size: 1.25rem; }

.auth-card {
  max-width: var(--width-auth);
  margin: 0 auto;
}

.auth-card .card-title { text-align: center; }

.auth-alt {
  margin: var(--space-3) 0 0;
  text-align: center;
}

.divider {
  margin: var(--space-4) 0;
  border: 0;
  border-top: 1px solid var(--color-border);
}

.settings-section + .settings-section { margin-top: var(--space-4); }

.link-list { margin: 0; padding-left: var(--space-4); }

/* Forms */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field-label {
  font-size: var(--font-size-small);
  font-weight: 600;
  color: var(--color-muted);
}

.field-input {
  width: 100%;
  padding: 0.75rem var(--space-3);
  font: inherit;
  font-size: var(--font-size-input);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
}

.field-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-focus);
}

.field-input[readonly] {
  background: var(--color-surface-alt);
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
}

.field-hint {
  margin: calc(-1 * var(--space-2)) 0 0;
  font-size: var(--font-size-small);
  color: var(--color-muted);
}

.form-error {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-small);
  background: var(--color-error-bg);
  color: var(--color-error);
  font-size: var(--font-size-small);
}

.form-error-list { margin: 0; padding-left: var(--space-3); }

.form-success {
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-small);
  background: var(--color-success-bg);
  color: var(--color-success);
  font-size: var(--font-size-small);
}

/* Buttons */

.button {
  display: inline-block;
  padding: 0.6rem var(--space-3);
  font: inherit;
  font-weight: 600;
  text-align: center;
  border: 0;
  border-radius: var(--radius-small);
  cursor: pointer;
}

.button:hover { text-decoration: none; }
.button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-focus); }
.button:disabled { opacity: 0.6; cursor: default; }

.button-primary {
  width: 100%;
  font-size: 1.125rem;
  background: var(--color-accent);
  color: var(--color-on-accent);
}
.button-primary:hover:not(:disabled) { background: var(--color-accent-hover); }

.button-create {
  background: var(--color-create);
  color: var(--color-on-create);
}
.button-create:hover:not(:disabled) { background: var(--color-create-hover); }

.button-secondary {
  background: var(--color-secondary);
  color: var(--color-text);
}
.button-secondary:hover:not(:disabled) { background: var(--color-secondary-hover); }

.settings .button-primary { width: auto; align-self: flex-start; font-size: 1rem; }

/* Lists of sessions and invites */

.item-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--color-border);
}

.item:first-child { border-top: 0; }

.item-body { min-width: 0; }

.item-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.item-meta {
  font-size: var(--font-size-small);
  color: var(--color-muted);
}

.badge {
  flex-shrink: 0;
  padding: var(--space-1) var(--space-2);
  border-radius: 999px;
  background: var(--color-success-bg);
  color: var(--color-success);
  font-size: var(--font-size-small);
  font-weight: 600;
}

/* The Friends mark goes with the secondary buttons beside it. */
.badge.friends { background: var(--color-secondary); color: var(--color-text); }

.badge-muted {
  background: var(--color-secondary);
  color: var(--color-muted);
}

.invite-created { margin: var(--space-3) 0; }
#invite-create + .form-error { margin-top: var(--space-3); }

/* Navigation extras */

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; }

/* Top-bar icons: round hit areas, counts overlaid on the corner. */
.topbar-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  color: var(--color-text);
  font-size: 1.25rem;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.topbar-icon:hover { text-decoration: none; background: rgba(0, 0, 0, 0.06); }
.topbar-icon:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-focus); }
.topbar-icon .count { position: absolute; top: 0; right: -0.25rem; margin: 0; }

/* Brand left, navigation centred, settings, log out and you on the right. */
.topbar-rest { display: contents; }
.topbar-center { grid-column: 2; gap: var(--space-2); }
.topbar-end { grid-column: 3; justify-self: end; }
.topbar-center .topbar-icon { width: 3rem; color: var(--color-muted); }
.topbar-center .topbar-icon:hover { color: var(--color-text); }
@media (max-width: 30rem) {
  .topbar { gap: var(--space-1); }
  .topbar-brand { font-size: 1.25rem; }
  .topbar-center { gap: 0; }
  .topbar-center .topbar-icon, .topbar-icon { width: 2.25rem; height: 2.25rem; }
}

.count {
  display: inline-block;
  min-width: 1.25rem;
  margin-left: var(--space-1);
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--color-error);
  color: var(--color-on-accent);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
}

/* Profile */

.profile-name { margin-bottom: 0; }
.profile-bio { margin: 0 0 var(--space-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-bio:empty { display: none; }
.profile-stats { margin: 0 0 var(--space-3); color: var(--color-muted); }
.profile-stats .stat { color: var(--color-text); font-weight: 600; }

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.button-link {
  padding: 0;
  font: inherit;
  font-size: var(--font-size-small);
  color: var(--color-muted);
  background: none;
  border: 0;
  cursor: pointer;
}
.button-link:hover { color: var(--color-error); text-decoration: underline; }
.button-link:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-focus); }

.confirm {
  padding: var(--space-3);
  border-radius: var(--radius-small);
  background: var(--color-error-bg);
}
.confirm-text { margin: 0 0 var(--space-2); }
.confirm-actions { display: flex; gap: var(--space-2); }

.button-danger {
  background: var(--color-error);
  color: var(--color-on-accent);
}
.button-danger:hover:not(:disabled) { filter: brightness(1.08); }

.button-accent {
  background: var(--color-accent);
  color: var(--color-on-accent);
}
.button-accent:hover:not(:disabled) { background: var(--color-accent-hover); }

.profile + .settings-section,
.profile > .settings-section { margin-top: var(--space-4); }

/* People lists */

.person-link { color: var(--color-text); flex: 1; }
.person-link:hover { text-decoration: none; }
.person-link:hover .item-title { text-decoration: underline; }

/* View.Components.Person: li.person, a Card in .person-grid or a Row (.item). */
.person.item { display: block; }
.person-main { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.person-avatar { display: flex; flex: none; }
.person-avatar:hover { text-decoration: none; }
.person-text { flex: 1; min-width: 0; }
.person-name-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); color: var(--color-muted); }
.person-name { font-weight: 600; color: var(--color-text); overflow-wrap: anywhere; }
.person .confirm { margin-top: var(--space-3); }

.person-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-2);
}

.person-actions .button { padding: 0.4rem 0.75rem; font-size: var(--font-size-small); }

.show-more { margin-top: var(--space-3); text-align: center; }
.show-more .form-error { margin-bottom: var(--space-2); }

.field-textarea { resize: vertical; min-height: 5rem; }

/* Feed, posts and threads */

.feed-page { display: flex; flex-direction: column; gap: var(--space-4); }

.section-title {
  margin: var(--space-4) 0 var(--space-2);
  font-size: 1.25rem;
  font-weight: 600;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
  padding: var(--space-1) var(--space-2);
  font: inherit;
  line-height: 1.2;
  color: var(--color-muted);
  background: none;
  border: 0;
  border-radius: var(--radius-small);
  cursor: pointer;
}
.icon-button:hover:not(:disabled) { background: var(--color-surface-alt); color: var(--color-text); }
.icon-button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-focus); }
.icon-button:disabled { opacity: 0.5; cursor: default; }

.composer { display: flex; flex-direction: column; gap: var(--space-2); }
.composer-edit { margin: var(--space-2) 0; }
.composer-bar { display: flex; align-items: center; gap: var(--space-2); }
.composer-spacer { flex: 1; }
.composer-compact .field-textarea { min-height: 0; resize: none; overflow: hidden; }

.audience-menu { position: relative; }
.audience-button { white-space: nowrap; }
.audience-backdrop { position: fixed; inset: 0; z-index: 10; }

.audience-choices {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 11;
  width: max-content;
  margin: var(--space-1) 0 0;
  padding: var(--space-1) 0;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.15);
}

.audience-choice {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-1) var(--space-3);
  font: inherit;
  text-align: left;
  white-space: nowrap;
  color: var(--color-text);
  background: none;
  border: 0;
  cursor: pointer;
}
.audience-choice:hover,
.audience-choice:focus-visible { outline: none; background: var(--color-highlight); }
.audience-choice.is-selected { font-weight: 600; }
.audience-choice-icon { display: inline-flex; min-width: 1.5rem; }

.audience-users { display: flex; flex-direction: column; gap: var(--space-1); }
.audience-chips { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.audience-chips:empty { display: none; }

.audience-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-1) 0 var(--space-2);
  border-radius: 999px;
  background: var(--color-secondary);
  font-size: var(--font-size-small);
}

.audience-chip-remove {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-1);
  font: inherit;
  color: var(--color-muted);
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.audience-chip-remove:hover { color: var(--color-error); }
.audience-chip-remove .icon { width: 1em; height: 1em; }

.audience-filter { padding: var(--space-2) var(--space-3); font-size: 1rem; }

.audience-candidates {
  margin: 0;
  padding: var(--space-1) 0;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
}

.audience-candidate { padding: var(--space-1) var(--space-3); cursor: pointer; }
.audience-candidate:hover,
.audience-candidate:focus { outline: none; background: var(--color-highlight); }
.audience-note { margin: 0; font-size: var(--font-size-small); }

.post-list { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.post-list-wrap .empty { margin-top: var(--space-3); }

.post-card { padding: var(--space-3) var(--space-4); }

.post-head { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
.post-author { font-weight: 600; color: var(--color-text); }
.post-meta { display: flex; align-items: baseline; gap: var(--space-2); font-size: var(--font-size-small); color: var(--color-muted); }
.post-time { color: var(--color-muted); }
.post-tools { display: flex; gap: var(--space-1); margin-left: auto; }
.edited { color: var(--color-muted); cursor: default; }

.post-body {
  margin: var(--space-2) 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.post-card .confirm { margin: var(--space-2) 0; }

/* Post bar: react and comment with their counts on the left, the top reactions on the right. */
.post-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-top: var(--space-2); }
.post-bar-actions { display: flex; align-items: center; gap: var(--space-1); }
.post-bar-actions .reactions { gap: var(--space-1); }
.post-reaction-total { margin-right: var(--space-3); font-size: var(--font-size-small); color: var(--color-muted); }
.post-comment-count { font-size: var(--font-size-small); color: var(--color-muted); }
.post-comments-toggle { gap: var(--space-1); }

/* The top reactions as overlapping bubbles; clicking them lists who reacted. */
.post-bar-reactions { position: relative; }
.post-reactions-summary { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2); font: inherit; font-size: var(--font-size-small); color: var(--color-muted); background: none; border: 0; border-radius: 999px; cursor: pointer; }
.post-reactions-summary:hover, .post-reactions-summary:focus-visible { outline: none; background: var(--color-highlight); }
.post-reactions-summary { gap: 0; }
.reaction-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  font-size: 0.9rem;
  background: var(--color-surface);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--color-surface);
}
.reaction-bubble + .reaction-bubble { margin-left: -0.2rem; }
.reactors { position: absolute; right: 0; bottom: calc(100% + var(--space-1)); z-index: 11; width: min(18rem, 80vw); max-height: 20rem; overflow-y: auto; padding: var(--space-2) var(--space-3); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); }
.reactors-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-1); }
.reactors-title { font-weight: 600; }
.reactors-list { margin: 0; padding: 0; list-style: none; }
.reactor { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-1) 0; }
.reactor-link { display: flex; align-items: center; gap: var(--space-2); min-width: 0; color: var(--color-text); font-weight: 500; }
.reactor-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reactor-kind { font-size: 1.1rem; }

/* Reactions: the picker opens on hover or keyboard focus */

.reactions { display: flex; align-items: center; gap: var(--space-2); }
.react { position: relative; }
.react-button { font-size: 1.1rem; }
.react-button.is-none { filter: grayscale(1); opacity: 0.55; }

.reaction-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  z-index: 2;
  display: none;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
  white-space: nowrap;
}
.react:hover .reaction-picker,
.react:focus-within .reaction-picker { display: flex; }

.reaction-pick {
  padding: var(--space-1);
  font-size: 1.25rem;
  line-height: 1;
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.1s;
}
.reaction-pick:hover,
.reaction-pick:focus-visible { outline: none; transform: scale(1.25); background: var(--color-highlight); }
.reaction-pick.is-mine { background: var(--color-secondary); }

.reactions-summary { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--font-size-small); color: var(--color-muted); cursor: default; }
.reactions-top { letter-spacing: -0.15em; }

/* Threads */

.thread {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.comment-list { margin: 0; padding: 0; list-style: none; }

/* A comment (as Facebook): avatar, then name · time, the text, and a row of actions
   with the reactions after them. Replies line up under their parent's text. */
.comment { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-3) 0 0; }
.comment.indent-1 { margin-left: 40px; }
.comment.indent-2 { margin-left: 80px; }
.comment-avatar { display: inline-flex; flex: none; }
.comment-avatar:hover { text-decoration: none; }
.comment-avatar .avatar-small { width: 32px; height: 32px; font-size: 0.75rem; }
.comment-main { flex: 1; min-width: 0; }

.comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1); font-size: var(--font-size-small); color: var(--color-muted); }
.comment-author { font-weight: 600; color: var(--color-text); }
.comment-parent { font-size: var(--font-size-small); }
.comment-body { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); margin-top: var(--space-1); font-size: var(--font-size-small); color: var(--color-muted); }
.comment-bar .reactions { gap: var(--space-1); }
.comment-bar .react-button { padding: 0; font-size: 0.95rem; }
.comment-bar .reactions-summary { gap: 0; }
.comment-bar .reactions-total { margin-left: var(--space-1); }
.comment-bar .icon-button { padding: 2px; color: var(--color-muted); }
.comment-bar .icon-button:hover:not(:disabled) { color: var(--color-text); background: none; }
.comment-bar .icon-button:focus-visible { color: var(--color-text); }
.comment-bar .icon-button .icon { width: 1rem; height: 1rem; }
.comment-tools .group-menu { left: 0; right: auto; }
/* "…" shows while the pointer is on the comment, it has focus or its menu is open;
   always on touch screens, which have no hover. */
@media (hover: hover) {
  .comment-tools { visibility: hidden; }
  .comment:hover .comment-tools,
  .comment:focus-within .comment-tools,
  .comment-tools:has([aria-expanded="true"]) { visibility: visible; }
}
.comment-placeholder { cursor: default; }
.comment.placeholder { display: flex; gap: var(--space-2); align-items: baseline; }

.comment-composer { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-1); margin-top: var(--space-2); }
.comment-composer .form-error { flex-basis: 100%; }
.comment-input {
  flex: 1;
  min-height: 2.5rem;
  padding: var(--space-2) var(--space-3);
  font-size: 1rem;
  resize: vertical;
}
.comment-submit { align-self: center; color: var(--color-accent); }
.reply-composer, .edit-composer { margin-top: var(--space-1); }

.list-loading { margin: var(--space-2) 0; }
.sentinel { height: 1px; }

@media (max-width: 30rem) {
  .item { flex-wrap: wrap; }
  .person.item .person-main { flex-wrap: wrap; }
  .person.item .person-actions { margin-left: auto; }
  .topbar { padding: var(--space-1) var(--space-3); }
}

/* Media (S4) */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Avatars: a photo, or initials on one of eight colours picked from the user id */

.avatar-color-0 { --avatar-color: #e57373; }
.avatar-color-1 { --avatar-color: #f0a35e; }
.avatar-color-2 { --avatar-color: #d4b13f; }
.avatar-color-3 { --avatar-color: #7cb36b; }
.avatar-color-4 { --avatar-color: #3fa69a; }
.avatar-color-5 { --avatar-color: #4f8fd1; }
.avatar-color-6 { --avatar-color: #8a7bd1; }
.avatar-color-7 { --avatar-color: #c675b5; }

.avatar {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-surface-alt);
  vertical-align: middle;
}
.avatar-initials {
  color: #ffffff;
  background: var(--avatar-color);
  font-weight: 600;
  letter-spacing: 0.02em;
  user-select: none;
}
.avatar-small { width: 40px; height: 40px; font-size: 0.95rem; }
.avatar-large { width: 128px; height: 128px; font-size: 2.75rem; }

.topbar-name { display: inline-flex; align-items: center; gap: var(--space-2); }
.topbar-name .avatar-small { width: 28px; height: 28px; font-size: 0.75rem; }

.post-head { align-items: center; }
.post-avatar { display: inline-flex; }
.post-avatar:hover { text-decoration: none; }

.person-link { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.person-text { min-width: 0; }

/* Progress rings: ring-0 .. ring-10 set how much is filled */

.ring-0 { --ring: 0%; }
.ring-1 { --ring: 10%; }
.ring-2 { --ring: 20%; }
.ring-3 { --ring: 30%; }
.ring-4 { --ring: 40%; }
.ring-5 { --ring: 50%; }
.ring-6 { --ring: 60%; }
.ring-7 { --ring: 70%; }
.ring-8 { --ring: 80%; }
.ring-9 { --ring: 90%; }
.ring-10 { --ring: 100%; }

.composer-image-progress, .media-progress {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: conic-gradient(var(--color-accent) var(--ring), var(--color-border) 0);
  -webkit-mask: radial-gradient(circle, transparent 55%, #000 56%);
  mask: radial-gradient(circle, transparent 55%, #000 56%);
}

/* Composer photos */

.composer-image-picker { display: inline-flex; }
.composer-image-button.is-disabled { opacity: 0.5; cursor: default; }
.composer-image-button:focus-within { box-shadow: 0 0 0 3px var(--color-focus); }

.composer-images {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.composer-image {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  overflow: hidden;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  cursor: grab;
}
.composer-image img { width: 100%; height: 100%; object-fit: cover; }
.composer-image.is-dragging { opacity: 0.4; }
.composer-image-failed { border-color: var(--color-error); background: var(--color-error-bg); cursor: default; }
.composer-image-error { font-size: 1.5rem; color: var(--color-error); }
.composer-image-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.55);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.composer-image-remove:hover { background: rgba(0, 0, 0, 0.8); }
.composer-image-remove:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-focus); }

/* Post images: 1 natural, 2 side by side, 3 big + two stacked, 4+ 2x2 with "+N" */

.post-images {
  display: grid;
  gap: 3px;
  margin: var(--space-2) 0;
  overflow: hidden;
  border-radius: var(--radius-small);
}
.post-image-cell { position: relative; min-width: 0; min-height: 0; }
.post-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--color-surface-alt);
  cursor: zoom-in;
}
.post-images-1 .post-image { height: auto; max-height: 60vh; }
.post-images-2 { grid-template-columns: 1fr 1fr; }
.post-images-2 .post-image-cell { aspect-ratio: 1; }
.post-images-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 3 / 2; }
.post-images-3 .post-image-cell:first-child { grid-row: 1 / span 2; }
.post-images-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 1; }
.post-images-more {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 2rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

/* Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
}
.lightbox-image { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.lightbox-button {
  position: absolute;
  width: 3rem;
  height: 3rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 1.5rem;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.4);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.lightbox-button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.2); }
.lightbox-button:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6); }
.lightbox-button:disabled { opacity: 0.25; cursor: default; }
#lightbox-close { top: var(--space-3); right: var(--space-3); }
#lightbox-prev { left: var(--space-3); top: 50%; transform: translateY(-50%); }
#lightbox-next { right: var(--space-3); top: 50%; transform: translateY(-50%); }
.lightbox-counter {
  position: absolute;
  bottom: var(--space-3);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-1) var(--space-3);
  color: #ffffff;
  font-size: var(--font-size-small);
  background: rgba(0, 0, 0, 0.5);
  border-radius: 999px;
}

/* A post's image in the lightbox, with its own author, caption, reactions and thread
   beside it (plan/individual-images I11); below it on narrow screens. */
.lightbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.lightbox-with-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(18rem, 28vw, 24rem);
}
.lightbox-with-panel .lightbox-image { max-width: 100%; max-height: 100vh; }
/* The frame shrink-wraps the photo, so tags placed in percent sit on it. */
.lightbox-frame { position: relative; display: flex; max-width: 100%; max-height: 100%; line-height: 0; }
.lightbox-frame.is-tagging .lightbox-image { cursor: crosshair; }
.tag-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: var(--space-1) var(--space-2);
  color: #ffffff;
  font-size: var(--font-size-small);
  line-height: 1.3;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-small);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.tag-marker.is-pending { border-style: dashed; }
.lightbox-frame:hover .tag-marker, .lightbox-frame.is-tagging .tag-marker { opacity: 1; }
.tag-picker {
  position: absolute;
  z-index: 2;
  width: 15rem;
  transform: translate(-50%, var(--space-2));
  padding: var(--space-2);
  line-height: 1.4;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  cursor: auto;
}
.tag-picker-list { margin: var(--space-2) 0 0; padding: 0; list-style: none; max-height: 14rem; overflow-y: auto; }
.tag-picker-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-1) var(--space-2);
  font: inherit;
  color: inherit;
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--radius-small);
  cursor: pointer;
}
.tag-picker-user:hover, .tag-picker-user:focus-visible { outline: none; background: var(--color-surface-alt); }
.tag-picker-empty { margin: var(--space-2) 0 0; }
.lightbox-tags { margin-bottom: var(--space-2); }
.tag-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); margin: 0 0 var(--space-1); padding: 0; list-style: none; }
.tag-with { font-size: var(--font-size-small); }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.1rem var(--space-1) 0.1rem var(--space-2);
  font-size: var(--font-size-small);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}
.tag-chip.is-pending { border-style: dashed; }
.tag-chip a { color: var(--color-text); font-weight: 600; text-decoration: none; }
.tag-chip a:hover { text-decoration: underline; }
.tag-chip-note { color: var(--color-muted); }
.tag-remove { width: 1.5rem; height: 1.5rem; padding: 0; font-size: 0.9rem; }
.tag-toggle, .tag-approve { color: var(--color-accent); font-size: var(--font-size-small); }
.tag-toggle:hover, .tag-approve:hover { color: var(--color-accent-hover); }
.tag-hint { margin: var(--space-1) 0 0; font-size: var(--font-size-small); }
.lightbox-panel {
  height: 100vh;
  overflow-y: auto;
  padding: var(--space-3);
  color: var(--color-text);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  cursor: auto;
}
.lightbox-head { margin-bottom: var(--space-2); }
.lightbox-caption { margin: 0 0 var(--space-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.lightbox-bar { margin-bottom: var(--space-2); }
.caption-edit { margin-left: var(--space-1); color: var(--color-muted); font-size: var(--font-size-small); }
.caption-edit:hover { color: var(--color-accent); }
.caption-composer { margin-bottom: var(--space-3); }
.form-warning {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  color: var(--color-text);
  background: var(--color-highlight);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--font-size-small);
}
.caption-actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.lightbox-comment-count { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--color-muted); }
@media (max-width: 40rem) {
  .lightbox-with-panel { display: block; overflow-y: auto; }
  .lightbox-with-panel .lightbox-stage { height: 70vh; }
  .lightbox-with-panel .lightbox-image { max-height: 70vh; }
  .lightbox-frame .tag-marker { opacity: 1; }
  .lightbox-panel { height: auto; min-height: 30vh; border-left: 0; border-top: 1px solid var(--color-border); }
}

/* Profile and group heads: cover, avatar, name and actions (see "Page heads" below) */

.profile-card { padding-top: 0; overflow: hidden; }
.profile-cover-wrap { position: relative; aspect-ratio: 3 / 1; }
/* The profile photo and cover open in the lightbox. */
.image-open { display: block; width: 100%; height: 100%; padding: 0; background: none; border: 0; border-radius: inherit; cursor: zoom-in; }
.image-open:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-focus); }
.profile-cover { display: block; width: 100%; height: 100%; object-fit: cover; }
.profile-cover-empty {
  background: linear-gradient(135deg, var(--avatar-color), color-mix(in srgb, var(--avatar-color) 35%, var(--color-surface)));
  opacity: 0.85;
}
.profile-avatar { position: relative; flex: none; border-radius: 50%; }
.profile-avatar .avatar-large { display: flex; }

.media-controls { position: absolute; display: flex; align-items: center; gap: var(--space-2); }
.media-change, .media-remove { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.media-change:focus-within { box-shadow: 0 0 0 3px var(--color-focus); }
.media-change.is-disabled { opacity: 0.5; cursor: default; }
.media-progress, .media-error { position: absolute; top: var(--space-2); right: var(--space-2); }
.profile-avatar .media-progress, .profile-avatar .media-error { top: 50%; right: auto; left: 50%; transform: translate(-50%, -50%); }
.media-error {
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  width: max-content;
  max-width: min(20rem, 80vw);
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-2);
  color: var(--color-error);
  font-size: var(--font-size-small);
  font-weight: 600;
  background: var(--color-error-bg);
  border: 1px solid currentColor;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  cursor: default;
}
/* Under the avatar rather than over it, so the message has room. */
.profile-avatar .media-error { top: calc(100% + var(--space-1)); transform: translateX(-50%); }
.upload-errors { margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.upload-errors .icon { vertical-align: -0.3em; }

/* Cover: a white pill bottom-right, a small round remove beside it. */
.profile-cover-wrap .media-controls { right: var(--space-3); bottom: var(--space-3); }
.profile-cover-wrap .media-change,
.profile-cover-wrap .media-remove {
  height: 2.25rem;
  color: #1c1e21;
  font-weight: 600;
  background: #ffffff;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.profile-cover-wrap .media-change { gap: var(--space-2); padding: 0 var(--space-3); }
.profile-cover-wrap .media-remove { width: 2.25rem; padding: 0; }
.profile-cover-wrap .media-change:hover:not(.is-disabled),
.profile-cover-wrap .media-remove:hover:not(:disabled) { color: #1c1e21; background: #e4e6eb; }

/* Avatar: a round grey camera badge bottom-right, remove top-right. */
.profile-avatar .media-controls { position: static; }
.profile-avatar .media-change,
.profile-avatar .media-remove {
  position: absolute;
  color: var(--color-text);
  background: var(--color-surface-alt);
  border: 2px solid var(--color-surface);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.profile-avatar .media-change { right: 6px; bottom: 6px; width: 2.5rem; height: 2.5rem; padding: 0; }
.profile-avatar .media-remove { right: 6px; top: 6px; width: 1.75rem; height: 1.75rem; padding: 0; font-size: 0.8rem; }
.profile-avatar .media-change:hover:not(.is-disabled),
.profile-avatar .media-remove:hover:not(:disabled) { color: var(--color-text); background: var(--color-border); }

/* Settings, Profile: each section is a row, heading and controls on top, the current
   picture below. Pictures save on upload; the form below them saves with Save. */
.button-with-icon { display: inline-flex; align-items: center; gap: var(--space-2); }
a#profile-edit:hover { text-decoration: none; }
.profile-edit { padding: var(--space-4); }
.profile-edit + * { margin-top: var(--space-4); }
.edit-row { padding: var(--space-3) 0; border-top: 1px solid var(--color-border); }
.edit-row:first-of-type { border-top: 0; padding-top: 0; }
.edit-row-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); }
.edit-row-title { margin: 0; font-size: 1.0625rem; font-weight: 600; }
.edit-media { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-2); }
.edit-media .media-controls { position: static; }
.edit-media .media-change,
.edit-media .media-remove {
  height: 2.25rem;
  color: var(--color-text);
  font-weight: 600;
  background: var(--color-secondary);
  border: 0;
  border-radius: var(--radius-small);
}
.edit-media .media-change { gap: var(--space-2); padding: 0 var(--space-3); }
.edit-media .media-remove { width: 2.25rem; padding: 0; }
.edit-media .media-change:hover:not(.is-disabled),
.edit-media .media-remove:hover:not(:disabled) { background: var(--color-secondary-hover); }
.edit-media .media-progress, .edit-media .media-error { position: static; }
.edit-media .media-error { order: 1; flex-basis: 100%; }
.edit-avatar { display: flex; justify-content: center; }
.edit-cover { display: block; width: 100%; max-width: 32rem; margin: 0 auto; aspect-ratio: 3 / 1; object-fit: cover; border-radius: var(--radius-small); }
.edit-form { padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
.edit-form .field-label { color: var(--color-text); font-size: 1.0625rem; }
.edit-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
.edit-actions .button-primary { width: auto; font-size: 1rem; }
.settings-tabs .friends-tab-label { display: inline; }
.settings-sections > * + * { margin-top: var(--space-4); }
.settings-audiences { display: flex; flex-direction: column; gap: var(--space-1); margin: 0 0 var(--space-3); padding: 0; list-style: none; }
.settings-audience { padding: var(--space-2) var(--space-3); border-radius: var(--radius-small); }
.settings-audience.is-selected { background: var(--color-highlight); }

/* Groups */


.page-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); }
.page-head .page-title { flex: 1; margin-bottom: 0; }
.page-head-action { font-size: 1.25rem; }

.groups > .card, .groups > form { margin-bottom: var(--space-4); }
.group-form { padding: var(--space-3) var(--space-4); }
.group-filter-form { margin-bottom: var(--space-3); }
.group-privacy { cursor: default; }

.group-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.group-card {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
}
.group-card-cover { display: block; aspect-ratio: 3 / 1; }
.group-card-cover img, .group-card-cover-empty { display: block; width: 100%; height: 100%; object-fit: cover; }
.group-card-cover-empty {
  background: linear-gradient(135deg, var(--avatar-color), color-mix(in srgb, var(--avatar-color) 35%, var(--color-surface)));
  opacity: 0.85;
}
.group-card-body {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0 var(--space-2);
  padding: var(--space-2) var(--space-3);
}
.group-card-name { font-weight: 600; color: var(--color-text); overflow-wrap: anywhere; }
.group-card-facts { display: flex; align-items: center; gap: var(--space-2); font-size: var(--font-size-small); grid-column: 1; }
.group-card-members { cursor: default; }
.group-card .group-join, .group-card .group-joined { grid-column: 2; grid-row: 1 / span 2; }
.group-card .group-join, .group-card .group-leave { grid-column: 2; grid-row: 1 / span 2; padding: 0.4rem 0.75rem; font-size: var(--font-size-small); }
.group-joined { display: inline-flex; color: var(--color-success); padding: 0 var(--space-2); cursor: default; }

.group-item .person-link { gap: var(--space-3); }
.group-item .person-text { flex: 1; }

.group-facts { display: flex; align-items: center; gap: var(--space-3); margin: 0 0 var(--space-2); }
.group-member-count { cursor: default; }
.group-action { min-width: 2.5rem; height: 2.5rem; border: 1px solid var(--color-border); }
.group-joined-wrap, .member-menu-wrap { position: relative; }

.group-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 11;
  width: max-content;
  margin: var(--space-1) 0 0;
  padding: var(--space-1) 0;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.15);
}
.group-joined-wrap .group-menu { left: 0; right: auto; }
.group-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-1) var(--space-3);
  font: inherit;
  text-align: left;
  white-space: nowrap;
  color: var(--color-text);
  background: none;
  border: 0;
  cursor: pointer;
}
.group-menu-item:hover,
.group-menu-item:focus-visible { outline: none; background: var(--color-highlight); }

.group-page > * + * { margin-top: var(--space-4); }
.group-tabs { display: flex; gap: var(--space-2); }
.group-tab { padding: var(--space-1) var(--space-3); border-bottom: 3px solid transparent; border-radius: var(--radius-small) var(--radius-small) 0 0; }
.group-tab.is-selected { border-bottom-color: var(--color-accent); color: var(--color-text); }

.muted-notice { display: flex; padding: var(--space-2) var(--space-4); color: var(--color-muted); cursor: default; }

.group-members > * + * { margin-top: var(--space-4); }
.person-name-line .role-badge, .person-name-line .member-muted { display: inline-flex; cursor: default; }
#member-action-form input { margin-bottom: var(--space-2); }

.invite-sent { display: inline-flex; color: var(--color-success); padding: 0 var(--space-2); cursor: default; }
.invite-error { position: static; }
#group-invite-panel .field-input { margin-bottom: var(--space-2); }

.modlog-entry { display: block; }
.modlog-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.modlog-actor, .modlog-target { font-weight: 600; color: var(--color-text); }
.modlog-icon { display: inline-flex; color: var(--color-muted); cursor: default; }
.modlog-time { margin-left: auto; font-size: var(--font-size-small); cursor: default; }
.modlog-reason { margin: var(--space-1) 0 0; font-size: var(--font-size-small); white-space: pre-wrap; overflow-wrap: anywhere; }

.danger-zone {
  margin-top: var(--space-4);
  padding: var(--space-3);
  border-radius: var(--radius-small);
  background: var(--color-error-bg);
}
.danger-zone .field-input { margin-bottom: var(--space-2); }

/* Group posts in the feed: the group's avatar with the author's in its corner. */

.post-group-avatar { position: relative; }
.post-author-badge { position: absolute; right: -4px; bottom: -4px; display: inline-flex; border: 2px solid var(--color-surface); border-radius: 50%; }
.post-author-badge .avatar-small { width: 20px; height: 20px; font-size: 0.55rem; }
.post-head-text { display: flex; flex-direction: column; min-width: 0; }
.post-group-link { font-weight: 600; color: var(--color-text); }
.post-byline { display: flex; align-items: baseline; gap: var(--space-1); flex-wrap: wrap; font-size: var(--font-size-small); }
.post-byline .post-author { font-weight: 500; }
.post-delete-reason, .comment-delete-reason { margin-bottom: var(--space-2); padding: var(--space-1) var(--space-2); font-size: 1rem; }
.comment-remove { margin: var(--space-1) 0; padding: var(--space-2); }

/* Page heads (profile, group), Facebook style: a full-width band whose content sits
   in a container wider than the page column; the cover hangs from the top bar with
   rounded bottom corners, the avatar overlaps it by a third, name and actions beside. */
html { overflow-x: clip; }
.hero.profile-card {
  width: 100vw;
  max-width: none;
  margin: calc(-1 * var(--space-5)) 0 var(--space-4) calc(50% - 50vw);
  padding: 0;
  border-radius: 0;
  border-width: 0 0 1px;
  box-shadow: none;
  overflow: visible; /* upload errors may hang below the avatar */
}
.hero .profile-avatar .media-error { left: 0; transform: none; }
.hero-inner { max-width: 68rem; margin: 0 auto; }
.hero .profile-cover-wrap {
  aspect-ratio: auto;
  height: clamp(8rem, 20vw, 16.5rem);
  overflow: hidden;
  border-radius: 0 0 var(--radius) var(--radius);
}
.hero-body { display: flex; align-items: flex-start; gap: var(--space-4); padding: 0 2rem var(--space-3); }
.hero .profile-avatar { margin-top: -56px; border: 4px solid var(--color-surface); background: var(--color-surface); }
.hero .avatar-large { width: 168px; height: 168px; font-size: 3.5rem; }
.hero-main { display: flex; flex: 1; flex-wrap: wrap; align-items: flex-start; gap: var(--space-3); min-width: 0; padding-top: var(--space-4); }
.hero-text { flex: 1; min-width: 12rem; }
.hero .profile-name { margin: 0; font-size: 2rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.hero .profile-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-1); margin: var(--space-1) 0 var(--space-2); }
.hero .group-facts { gap: var(--space-3); }
.hero .profile-bio { margin: 0; }
.hero .profile-actions { justify-content: flex-end; }
.hero-confirm { margin: 0 2rem var(--space-3); }
.hero-tabs { margin: 0 2rem; border-top: 1px solid var(--color-border); }
.hero-tabs .group-tabs { padding-top: var(--space-1); }
.button-icon { display: inline-flex; align-items: center; justify-content: center; padding: 0.6rem; }

@media (max-width: 700px) {
  .hero-body { flex-direction: column; align-items: center; padding: 0 var(--space-3) var(--space-3); text-align: center; }
  .hero .profile-avatar { margin-top: -84px; }
  .hero-main { flex-direction: column; align-items: center; padding-top: 0; width: 100%; }
  .hero-text { min-width: 0; }
  .hero .profile-stats { justify-content: center; }
  .hero .profile-actions { justify-content: center; }
  .hero-confirm { margin: 0 var(--space-3) var(--space-3); }
  .hero-tabs { margin: 0 var(--space-3); }
  .hero .profile-cover-wrap { border-radius: 0; }
  .profile-cover-wrap .media-change-text { display: none; }
  .profile-cover-wrap .media-controls { top: var(--space-3); bottom: auto; }
  .profile-cover-wrap .media-change { width: 2.25rem; padding: 0; }
}

/* Profile tabs (in the head, like the group's), then each tab's content. */
.profile-tabs { display: flex; gap: var(--space-1); padding-top: var(--space-1); overflow-x: auto; scrollbar-width: none; }
.profile-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  color: var(--color-muted);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  border-radius: var(--radius-small) var(--radius-small) 0 0;
}
.profile-tab:hover { text-decoration: none; color: var(--color-text); background: var(--color-surface-alt); }
.profile-tab.is-selected { color: var(--color-accent); border-bottom-color: var(--color-accent); }
.profile-posts > .composer + .post-list-wrap { margin-top: var(--space-4); }

.profile-comment-list { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.profile-comment { padding: var(--space-3) var(--space-4); }
.profile-comment-on {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--color-muted);
  font-size: var(--font-size-small);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.profile-comment-on .icon { vertical-align: -0.3em; }
.profile-comment-group { font-weight: 600; }
.profile-comment-excerpt { color: var(--color-text); }
.profile-comment .comment-body { margin: 0 0 var(--space-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-comment-meta { display: flex; align-items: center; gap: var(--space-3); font-size: var(--font-size-small); }
.profile-comments .show-more, .profile-photos .show-more { margin-top: var(--space-3); text-align: center; }

.profile-photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.profile-photo-button { display: block; width: 100%; padding: 0; border: 0; background: var(--color-surface-alt); cursor: zoom-in; }
.profile-photo-button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-focus); }
.profile-photo { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }

.profile-about-wrap > * + * { margin-top: var(--space-4); }
.about-list { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.about-item { display: flex; align-items: flex-start; gap: var(--space-3); overflow-wrap: anywhere; }
.about-item .icon { flex: none; color: var(--color-muted); }

@media (max-width: 40rem) {
  .profile-photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .profile-tab-label { display: none; }
  .profile-tabs { justify-content: space-around; }
}
@media (max-width: 30rem) {
  .profile-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Friends page */

.friends-head { flex-wrap: wrap; }
.friends-filter-wrap { position: relative; display: flex; align-items: center; flex: 0 1 16rem; color: var(--color-muted); }
.friends-filter-wrap .icon { position: absolute; left: var(--space-2); pointer-events: none; }
.friends-filter { width: 100%; padding: var(--space-1) var(--space-3) var(--space-1) 2.25rem; font-size: 1rem; border-radius: 999px; }
.friends-tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--color-border);
}
.friends-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2);
  color: var(--color-muted);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  border-radius: var(--radius-small) var(--radius-small) 0 0;
}
.friends-tab:hover { text-decoration: none; color: var(--color-text); background: var(--color-surface-alt); }
.friends-tab.is-selected { color: var(--color-accent); border-bottom-color: var(--color-accent); }
.friends-tab .count { margin-left: 0; }
.friends-sections > * + * { margin-top: var(--space-4); }

.person-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.person-card { padding: var(--space-3); }
.avatar-medium { width: 72px; height: 72px; font-size: 1.6rem; }
.friends-page .show-more, .friends-page .center { margin-top: var(--space-3); }

@media (max-width: 40rem) {
  .person-grid { grid-template-columns: 1fr; }
  .friends-tab-label { display: none; }
  .friends-tab { padding: var(--space-2); }
  .friends-filter-wrap { flex-basis: 100%; }
}

/* A profile's friends: the friends page's grid at its width; All and Common keep their labels. */
.profile-friends { width: min(64rem, calc(100vw - 2 * var(--space-3))); margin-left: 50%; translate: -50% 0; }
.profile-friends .show-more, .profile-friends .center { margin-top: var(--space-3); }
.profile-friends .friends-tab-label { display: inline; }

/* The friends page: as wide as the profile's friends. */
.friends-page { width: min(64rem, calc(100vw - 2 * var(--space-3))); margin-left: 50%; translate: -50% 0; }
.section-title { margin: 0 0 var(--space-3); font-size: 1.1rem; }

/* Top bar: black with white icons; the account menu drops down from your avatar. */
.topbar { background: #111111; border-bottom-color: #000000; }
.topbar-brand { color: #ffffff; }
.topbar .topbar-icon { color: #ffffff; }
.topbar .topbar-icon.is-selected, .topbar .topbar-icon[aria-current="page"] { background: rgba(255, 255, 255, 0.2); }
.account-menu { position: relative; }
.account-menu > summary { list-style: none; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu[open] > summary { background: rgba(255, 255, 255, 0.2); }
/* Hover inverts: a white disc with a black icon. */
.topbar .topbar-icon:hover, .topbar .topbar-center .topbar-icon:hover { color: #111111; background: #ffffff; }
.account-menu-items {
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 12rem;
  padding: var(--space-1);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.account-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  color: var(--color-text);
  font: inherit;
  font-weight: 500;
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--radius-small);
  cursor: pointer;
}
.account-menu-item:hover { text-decoration: none; background: var(--color-surface-alt); }

/* The bell (plan/notifications N2): the account menu's dropdown, wider, with rows. */
.bell-panel { width: min(24rem, calc(100vw - 2 * var(--space-3))); max-height: min(36rem, 80vh); overflow-y: auto; padding: var(--space-2); }
.bell-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-1) var(--space-2); }
.bell-head h2 { margin: 0; font-size: 1.25rem; }
.bell-tabs { display: flex; gap: var(--space-1); padding: 0 var(--space-2) var(--space-2); }
.bell-tab { padding: var(--space-1) var(--space-3); color: var(--color-text); font: inherit; font-weight: 600; background: none; border: 0; border-radius: 999px; cursor: pointer; }
.bell-tab:hover { background: var(--color-surface-alt); }
.bell-tab.active { color: var(--color-accent); background: var(--color-secondary); }
.bell-section { margin: var(--space-2) var(--space-2) var(--space-1); font-size: 1rem; }
.bell-item { align-items: flex-start; font-weight: 400; }
.bell-avatar { position: relative; flex: none; }
.bell-avatar .avatar-small { width: 48px; height: 48px; }
.bell-kind {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-surface);
  background: var(--color-accent);
  border: 2px solid var(--color-surface);
  border-radius: 50%;
}
.bell-kind .icon { width: 13px; height: 13px; vertical-align: 0; }
.bell-text { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.bell-excerpt { overflow: hidden; color: var(--color-muted); text-overflow: ellipsis; white-space: nowrap; }
.bell-time { color: var(--color-muted); font-size: 0.8rem; }
.bell-item.unread .bell-time { color: var(--color-accent); font-weight: 600; }
.bell-dot { flex: none; align-self: center; width: 10px; height: 10px; background: var(--color-accent); border-radius: 50%; }
.bell-empty { margin: var(--space-3); color: var(--color-muted); text-align: center; }
/* On a phone the bell isn't at the edge: pin the panel to the viewport instead. */
@media (max-width: 40rem) {
  .bell-panel { position: fixed; top: calc(var(--topbar-height) + var(--space-1)); right: var(--space-3); left: var(--space-3); width: auto; }
}

/* Messenger (plan/v1 S6-D5): inbox left, conversation right; one column under 700px. */

.site-main-wide { max-width: 72rem; padding-block: var(--space-3); }

.messenger {
  display: grid;
  grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
  height: calc(100vh - var(--topbar-height) - 6rem);
  min-height: 24rem;
  overflow: hidden;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.messenger-inbox {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 0;
  padding: var(--space-3) var(--space-2);
  border-right: 1px solid var(--color-border);
}
.messenger-inbox-head { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-2); }
.messenger-title { margin: 0; font-size: var(--font-size-title); }
.messenger-inbox .messenger-filter { width: auto; margin: 0 var(--space-2); }
.messenger-inbox-list { flex: 1; min-height: 0; overflow-y: auto; }

.conversation-list { margin: 0; padding: 0; list-style: none; }
.conversation-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  color: var(--color-text);
  border-radius: var(--radius-small);
}
.conversation-link:hover { text-decoration: none; background: var(--color-surface-alt); }
.conversation.is-active .conversation-link { background: var(--color-secondary); }
.conversation-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.conversation-name,
.conversation-last { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.conversation-last { display: flex; color: var(--color-muted); font-size: var(--font-size-small); }
.conversation-excerpt { overflow: hidden; text-overflow: ellipsis; }
.conversation-time { flex-shrink: 0; }
.conversation.is-unread .conversation-name,
.conversation.is-unread .conversation-last { color: var(--color-text); font-weight: 700; }
.unread-dot { flex-shrink: 0; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--color-accent); }

.avatar-single,
.avatar-stack { position: relative; display: inline-flex; flex-shrink: 0; width: 40px; height: 40px; }
.avatar-stack .avatar { position: absolute; width: 28px; height: 28px; font-size: 0.7rem; border: 2px solid var(--color-surface); }
.avatar-stack .avatar:first-child { top: 0; right: 0; }
.avatar-stack .avatar:last-child { bottom: 0; left: 0; }

.messenger-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.thread-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
}
.thread-empty .icon { width: 3rem; height: 3rem; }
.thread-error { margin: var(--space-3); }

.chat-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.chat-back { display: none; }
.chat-heading { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.chat-name { margin: 0; overflow: hidden; font-size: 1.1rem; white-space: nowrap; text-overflow: ellipsis; }
.chat-subtitle { font-size: var(--font-size-small); }
.icon-button.is-active { color: var(--color-accent); background: var(--color-secondary); }

.chat-main { display: flex; flex: 1; min-height: 0; }
.chat-column { position: relative; display: flex; flex: 1; flex-direction: column; min-width: 0; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-2) var(--space-3); }
/* The thread's scrollbar shows only while the pointer is over it (which covers wheel scrolling). */
.chat-scroll { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.chat-scroll:hover,
.chat-scroll:focus-visible { scrollbar-color: var(--color-muted) transparent; }
.chat-older { margin: var(--space-2) 0; }
.chat-error { margin: 0 var(--space-3); }
.chat-messages { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }

.message-time,
.message-system {
  margin: var(--space-3) auto var(--space-2);
  color: var(--color-muted);
  font-size: 0.8rem;
  text-align: center;
}
.message-system { margin-block: var(--space-1); }

.message { position: relative; display: flex; flex-direction: column; align-items: flex-start; margin-top: 2px; }
.message.is-first { margin-top: var(--space-2); }
.message.is-mine { align-items: flex-end; }
.message-sender { margin: 0 0 2px calc(40px + var(--space-2) + 0.5rem); color: var(--color-muted); font-size: 0.8rem; }
.message-row { display: flex; align-items: flex-end; gap: var(--space-2); max-width: 75%; }
.message.is-mine .message-row { flex-direction: row-reverse; }
.message-avatar { flex-shrink: 0; width: 40px; }
.message-avatar a:hover { text-decoration: none; }
.message-content { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.message.is-mine .message-content { align-items: flex-end; }

.message-bubble {
  padding: 0.45rem 0.8rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: var(--color-text);
  background: var(--color-surface-alt);
  border-radius: 1.1rem;
}
.message.is-mine .message-bubble { color: var(--color-on-accent); background: var(--color-accent); }
.message.is-mine .message-bubble a { color: inherit; text-decoration: underline; }
.message-bubble.message-unsent,
.message.is-mine .message-bubble.message-unsent {
  color: var(--color-muted);
  font-style: italic;
  background: transparent;
  border: 1px solid var(--color-border);
}
.message-edited { opacity: 0.75; font-size: 0.75rem; }
.message-images { width: min(20rem, 60vw); overflow: hidden; border-radius: 1rem; }

.message-reply {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  max-width: 20rem;
  padding: 0.25rem 0.6rem;
  overflow: hidden;
  color: var(--color-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  border-left: 3px solid var(--color-border);
}
.message-reply .icon { flex-shrink: 0; width: 1em; height: 1em; }
.message-reply-sender { font-weight: 600; }
.message-reply-excerpt { overflow: hidden; text-overflow: ellipsis; }
.message-reply.is-unavailable { font-style: italic; }

.message-actions { position: relative; display: flex; align-self: center; opacity: 0; }
.message:hover .message-actions,
.message-actions:focus-within,
.message-actions.is-open { opacity: 1; }
@media (hover: none) { .message-actions { opacity: 1; } }
.message-actions .icon-button { padding: 0.25rem; }
.message-menu-wrap { position: relative; }
.message-react .react-button { padding: 0.25rem; font-size: 1rem; }
.message.is-mine .message-react .reaction-picker { left: auto; right: 0; }

/* Reactions under a message (plan/reactions): one chip per kind, mine in the accent colour. */
.message-reactions { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: 2px; }
.message-reaction {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0 var(--space-2);
  font-size: var(--font-size-small);
  line-height: 1.6;
  color: var(--color-text);
  background: none;
  border: none;
  cursor: pointer;
}
.message-reaction:hover:not(:disabled) { color: var(--color-accent); }
.message-reaction.is-mine { color: var(--color-accent); font-weight: 600; }
.message-reaction:disabled { cursor: default; }
.message-reaction-emoji { font-size: 0.95rem; }
.message-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  z-index: 5;
  min-width: 8rem;
  margin: 0;
  padding: var(--space-1) 0;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  box-shadow: var(--shadow-card);
}
.message-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-1) var(--space-3);
  color: var(--color-text);
  font: inherit;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}
.message-menu-item:hover { background: var(--color-highlight); }
.message-confirm { max-width: 20rem; margin-top: var(--space-1); }

.message-edit-form { display: flex; flex-direction: column; gap: var(--space-1); min-width: 16rem; }
.message-edit-actions { display: flex; justify-content: flex-end; }

.message.is-pending .message-content { opacity: 0.55; }
.message.is-failed .message-content { opacity: 0.8; }
.message-failed { display: flex; align-items: center; gap: var(--space-1); color: var(--color-error); font-size: 0.8rem; }

.message-seen { margin-top: 2px; color: var(--color-muted); font-size: 0.75rem; }
.message-readers { display: flex; align-items: center; gap: 2px; margin-top: 2px; color: var(--color-muted); font-size: 0.7rem; }
.message-reader .avatar { width: 16px; height: 16px; font-size: 0.5rem; }

.chat-new-pill {
  position: absolute;
  bottom: 5rem;
  left: 50%;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  color: var(--color-on-accent);
  font: inherit;
  font-size: var(--font-size-small);
  background: var(--color-accent);
  border: 0;
  border-radius: 999px;
  box-shadow: var(--shadow-card);
  transform: translateX(-50%);
  cursor: pointer;
}
.chat-new-pill .icon { width: 1em; height: 1em; }

.chat-composer { padding: var(--space-2) var(--space-3); border-top: 1px solid var(--color-border); }
.chat-composer-row { display: flex; align-items: flex-end; gap: var(--space-1); }
.chat-input-wrap { display: flex; flex: 1; min-width: 0; }
.chat-input { flex: 1; min-height: 2.5rem; max-height: 10rem; padding: 0.5rem 0.9rem; resize: none; border-radius: 1.25rem; }
.chat-send { color: var(--color-accent); }
.chat-images { margin-bottom: var(--space-2); }
.chat-reply-strip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  color: var(--color-muted);
  font-size: var(--font-size-small);
}
.chat-reply-text { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-unread-bar {
  position: absolute;
  top: var(--space-2);
  left: 50%;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  color: var(--color-on-accent);
  font-size: var(--font-size-small);
  background: var(--color-accent);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
  transform: translateX(-50%);
}
.chat-unread-jump {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3);
  color: inherit;
  font: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}
.chat-unread-action { margin-left: var(--space-2); font-weight: 600; text-decoration: underline; }
.chat-unread-bar .icon { width: 1em; height: 1em; }
.chat-unread-bar .chat-unread-dismiss { padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1); color: inherit; }
.chat-requests-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.chat-requests-bar .icon { width: 1.25em; height: 1.25em; color: var(--color-accent); }
.chat-requests-text { flex: 1; font-weight: 600; }
.chat-requests-bar .button-primary { width: auto; padding: var(--space-1) var(--space-3); font-size: var(--font-size-small); }
.chat-cant-reply { margin: 0; padding: var(--space-3); text-align: center; border-top: 1px solid var(--color-border); }

.chat-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 18rem;
  padding: var(--space-3);
  overflow-y: auto;
  border-left: 1px solid var(--color-border);
}
.chat-info-person { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); text-align: center; }
.chat-info-person p { margin: 0; }
.chat-info-name { margin: 0; font-size: 1rem; }
.chat-info-title,
.chat-info-section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.chat-info-heading { margin: var(--space-2) 0 0; color: var(--color-muted); font-size: var(--font-size-small); }
.chat-rename { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
.chat-rename .field-input { flex: 1; min-width: 0; }
.chat-members { display: flex; flex-direction: column; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.chat-members .person.item { padding: var(--space-1) 0; border-top: 0; }
.chat-member .person-main { gap: var(--space-2); }
.chat-member .person-actions { gap: 0; }
.chat-admin-badge { display: inline-flex; color: var(--color-accent); }
.chat-member .person-actions .icon-button { padding: 0.25rem; }
.chat-leave { align-self: flex-start; margin-top: var(--space-2); }

.new-message { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border-bottom: 1px solid var(--color-border); }
.new-message .audience-candidate { display: flex; align-items: center; gap: var(--space-2); }
.new-message .audience-candidate .avatar { width: 28px; height: 28px; font-size: 0.7rem; }
.chat-add-picker .audience-candidate { display: flex; align-items: center; gap: var(--space-2); }
.chat-add-picker .audience-candidate .avatar { width: 28px; height: 28px; font-size: 0.7rem; }

@media (max-width: 700px) {
  .site-main-wide { padding: 0; }
  .messenger { grid-template-columns: minmax(0, 1fr); height: calc(100vh - var(--topbar-height)); border-radius: 0; }
  .messenger.is-thread-open .messenger-inbox { display: none; }
  .messenger:not(.is-thread-open) .messenger-thread { display: none; }
  .messenger-inbox { border-right: 0; }
  .chat-back { display: inline-flex; }
  .chat-info { position: absolute; inset: 0; z-index: 6; width: auto; background: var(--color-surface); border-left: 0; }
  .chat-main { position: relative; }
  .message-row { max-width: 88%; }
}
.messenger .audience-candidate-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.messenger .audience-candidate .muted { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.picker-field { position: relative; }
.picker-field .field-input { width: 100%; }
.picker-candidates { position: absolute; top: 100%; left: 0; right: 0; z-index: 8; max-height: 18rem; overflow-y: auto; box-shadow: var(--shadow-card); }
.picker-row { display: flex; align-items: center; gap: var(--space-1); }
.picker-row .picker-field { flex: 1; min-width: 0; }

/* Chat kinds and channels (plan/channels): the inbox's sections, the channel browser
   and forms, visitors, the channel info panel, a group's chat tab. */
.inbox-section + .inbox-section { margin-top: var(--space-3); padding-top: var(--space-2); border-top: 1px solid var(--color-border); }
.inbox-section-label { font-size: var(--font-size-small); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.inbox-section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-1); padding: 0 var(--space-1); }
.inbox-section-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1);
  color: var(--color-muted);
  font: inherit;
  font-weight: 600;
  background: none;
  border: 0;
  border-radius: var(--radius-small);
  cursor: pointer;
}
.inbox-section-toggle:hover { color: var(--color-text); background: var(--color-surface-alt); }
.inbox-section-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-focus); }
.inbox-section-count,
.unread-count {
  min-width: 1.25rem;
  padding: 0 0.35rem;
  color: var(--color-on-accent);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
  background: var(--color-accent);
  border-radius: 999px;
}
.unread-count.is-muted { color: var(--color-muted); background: var(--color-surface-alt); }
.inbox-section-actions { display: inline-flex; }
.inbox-section-actions .icon-button { padding: 0.25rem; }
.inbox-section-error { margin: var(--space-1) var(--space-2); font-size: var(--font-size-small); }
.conversation-muted { display: inline-flex; flex-shrink: 0; align-items: center; gap: var(--space-1); color: var(--color-muted); }
.conversation.is-muted.is-unread .conversation-name,
.conversation.is-muted.is-unread .conversation-last { color: var(--color-muted); font-weight: 400; }

.avatar-tile {
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: 1.25rem;
  background: var(--color-surface-alt);
  border-radius: var(--radius-small);
}
.avatar-square .avatar { border-radius: var(--radius-small); }

.channel-browser { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border-bottom: 1px solid var(--color-border); }
.channel-list { margin: 0; padding: 0; list-style: none; }
.channel-row { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) 0; }
.channel-row-link { display: flex; flex: 1; align-items: center; gap: var(--space-2); min-width: 0; padding: var(--space-1); color: var(--color-text); border-radius: var(--radius-small); }
.channel-row-link:hover { text-decoration: none; background: var(--color-surface-alt); }
.channel-visibility { display: inline-flex; margin-left: var(--space-1); color: var(--color-muted); }
.channel-members { display: inline-flex; flex-shrink: 0; align-items: center; font-size: var(--font-size-small); }
.channel-joined { display: inline-flex; padding: var(--space-1) var(--space-2); color: var(--color-accent); }
.channel-requested { display: inline-flex; padding: var(--space-1) var(--space-2); color: var(--color-muted); }
.channel-join, .channel-ask { color: var(--color-accent); }

.channel-name-field { display: flex; align-items: center; gap: var(--space-1); }
.channel-name-field .field-input { flex: 1; min-width: 0; }
.channel-hash { color: var(--color-muted); font-size: 1.25rem; font-weight: 700; }
.channel-choices { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.icon-toggles { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--color-border); border-radius: var(--radius-small); }
.channel-form-actions { display: flex; justify-content: flex-end; gap: var(--space-1); }
.channel-settings { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-2) 0; border-block: 1px solid var(--color-border); }
.checkbox-label,
.radio-label { display: flex; align-items: center; gap: var(--space-1); font-size: var(--font-size-small); }
.convert-history { display: flex; flex-direction: column; gap: var(--space-1); }
.notification-settings { display: flex; flex-direction: column; gap: var(--space-2); margin: 0 0 var(--space-3); padding: 0; list-style: none; }
.notification-settings .checkbox-label { gap: var(--space-2); font-size: inherit; }
.notification-settings input[type="checkbox"] { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--color-accent); }

.chat-subtitle { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.chat-member-count { display: inline-flex; flex-shrink: 0; align-items: center; }
.chat-topic { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-name a { color: inherit; }
.chat-visitor { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); }
.channel-listing { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); margin-top: var(--space-5); text-align: center; }
.channel-listing p { margin: 0; }

.chat-info-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.chat-info-facts { display: flex; gap: var(--space-2); margin: 0; }
.chat-info-topic { margin: 0; }
.chat-admin-badge.is-moderator,
.chat-admin-badge.is-muted { color: var(--color-muted); }
.channel-requests .count { margin-left: 0; }

.group-chat-card { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); color: var(--color-text); }
.group-chat-card:hover { text-decoration: none; background: var(--color-surface-alt); }
.group-chat-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.group-chat-name { font-weight: 600; }
.group-chat-last { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--font-size-small); }
.group-chat-card.is-unread .group-chat-name { font-weight: 700; }
.group-chat-join { align-items: center; gap: var(--space-2); }
.group-chat-join span { flex: 1; }

/* Login policy and second factors (plan/mfa). */
.auth-banner { background: var(--color-highlight); border-bottom: 1px solid var(--color-border); }
.auth-banner.is-limited { background: #fde2e1; }
.auth-banner-inner { max-width: 68rem; margin: 0 auto; padding: var(--space-2) var(--space-4); font-size: var(--font-size-small); }
.auth-banner a { font-weight: 600; margin-left: var(--space-1); }
.login-passkey { width: 100%; justify-content: center; margin-top: var(--space-3); }
.login-help { margin: var(--space-3) 0 0; text-align: center; font-size: var(--font-size-small); }
.login-help .button-link:hover { color: var(--color-accent); }
.recovery-code { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.05rem; letter-spacing: 0.04em; }
#reset-code, #admin-issued-code { padding: var(--space-2) var(--space-3); font-size: 1.4rem; text-align: center; background: var(--color-surface-alt); border-radius: var(--radius-small); }
.recovery-codes { margin: var(--space-3) 0; padding: var(--space-3); background: var(--color-highlight); border-radius: var(--radius-small); }
.recovery-code-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-1) var(--space-4); margin: var(--space-2) 0 var(--space-3); padding: 0; list-style: none; }
.auth-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.auth-actions p { flex: 1; min-width: 12rem; margin: 0; }
.totp-setup { align-items: flex-start; }
.totp-qr { display: block; width: 12rem; height: 12rem; image-rendering: pixelated; border: 1px solid var(--color-border); border-radius: var(--radius-small); }
.passkey-add { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2); }
.passkey-add .field { flex: 1; min-width: 12rem; }
.help-request { flex-wrap: wrap; }
.help-request-main { flex: 1; min-width: 14rem; }
.help-request-note { margin: var(--space-1) 0 0; padding-left: calc(32px + var(--space-2)); white-space: pre-wrap; }
.issued-code { border: 2px solid var(--color-accent); }

/* Realtime (plan/v1 S7-D5, S7-D6): typing and the offline icon. */
.conversation-typing { color: var(--color-accent); font-style: italic; }
.chat-typing { display: flex; align-items: baseline; gap: 0.15rem; margin: var(--space-2) 0 0 calc(40px + var(--space-2)); color: var(--color-muted); font-size: 0.8rem; }
.typing-dots { display: inline-flex; gap: 2px; }
.typing-dots span { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: typing-dot 1.2s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-dot { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .typing-dots span { animation: none; opacity: 0.6; } }
.topbar-offline { display: inline-flex; align-items: center; padding: var(--space-1); color: var(--color-muted); }

/* Mentions (plan/notifications N4): the @-picker under a text box (above it in the
   messenger, whose box sits at the bottom), mentions in bodies, the inbox's @. */
.mention-box { position: relative; display: flex; flex: 1; min-width: 0; }
.mention-box > .field-input { flex: 1; width: 100%; min-width: 0; }
/* The box's text is transparent; the backdrop behind it, with the same classes so it
   wraps alike, shows the text with mentions coloured. Nothing in a mention may change
   its width (no bold), or the caret would drift from the text. */
.mention-input { position: relative; color: transparent; caret-color: var(--color-text); background: transparent; scrollbar-gutter: stable; }
.mention-input::placeholder { color: var(--color-muted); }
/* Translucent, so the backdrop's text shows through the selection. */
.mention-input::selection { color: transparent; background: color-mix(in srgb, var(--color-mention) 30%, transparent); }
.mention-backdrop {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  min-height: 0;
  max-height: none;
  margin: 0;
  overflow: hidden;
  scrollbar-gutter: stable;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  pointer-events: none;
}
.mention-mark { color: var(--color-mention); background: var(--color-mention-bg); border-radius: 3px; }
.mention-picker {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 9;
  min-width: 16rem;
  max-width: 100%;
  margin: var(--space-1) 0 0;
  padding: var(--space-1) 0;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  box-shadow: var(--shadow-card);
}
.chat-input-wrap .mention-picker,
.message-edit-form .mention-picker { top: auto; bottom: 100%; margin: 0 0 var(--space-1); }
.mention-option { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-3); cursor: pointer; }
.mention-option .avatar { width: 28px; height: 28px; font-size: 0.7rem; }
.mention-option-name { font-weight: 600; white-space: nowrap; }
.mention-option .muted { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mention-option:hover,
.mention-option.is-selected { background: var(--color-highlight); }
.mention { color: var(--color-mention); font-weight: 600; text-decoration: none; }
a.mention:hover { text-decoration: underline; }
.message.is-mine .mention { color: inherit; text-decoration: underline; }
.conversation-mention {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-on-accent);
  background: var(--color-accent);
}

/* A box that takes dropped images while files are dragged over it (index.html). */
.is-drop-over { outline: 2px dashed var(--color-accent); outline-offset: -2px; background: var(--color-highlight); }

/* A comment's one photo (as Facebook): under its text, opening the lightbox; in the
   comment box, a thumbnail on its own line with a button to take it out. */
.comment-image { display: block; margin-top: var(--space-1); padding: 0; background: none; border: 0; cursor: zoom-in; }
.comment-image img { display: block; max-width: min(100%, 16rem); max-height: 14rem; border-radius: var(--radius-small); }
.comment-image-button { align-self: center; }
.comment-thumb { position: relative; flex-basis: 100%; display: flex; align-items: center; gap: var(--space-2); }
.comment-thumb img { display: block; max-width: 8rem; max-height: 6rem; border-radius: var(--radius-small); }
.comment-thumb-remove {
  position: absolute;
  top: var(--space-1);
  left: calc(min(8rem, 100%) - 1.75rem);
  display: inline-flex;
  padding: 2px;
  color: #fff;
  background: rgb(0 0 0 / 0.6);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.comment-thumb-remove .icon { width: 1rem; height: 1rem; }

/* Leaving from the header asks above the thread (the info panel asks in place). */
.chat-leave-bar { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); }
.chat-leave-bar .confirm { margin: 0; }

/* Settings > Appearance: each choice as a row of segments. */
.appearance-group { margin-bottom: var(--space-3); }
.appearance-title { margin: 0 0 var(--space-1); font-size: var(--font-size-small); font-weight: 600; color: var(--color-muted); }
.segmented { display: inline-flex; flex-wrap: wrap; padding: 2px; background: var(--color-surface-alt); border: 1px solid var(--color-border); border-radius: var(--radius); }
.segmented-option { padding: var(--space-1) var(--space-3); font: inherit; color: var(--color-text); background: none; border: 0; border-radius: var(--radius-small); cursor: pointer; }
.segmented-option:hover { background: var(--color-secondary-hover); }
.segmented-option.is-selected { color: var(--color-on-accent); background: var(--color-accent); font-weight: 600; }
.segmented-option:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-focus); }

/* Manage System: a left menu of main items, tabs under each (plan/admin) */
.site-main-tables { max-width: 76rem; }
.admin-layout { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.admin-menu { display: flex; flex-direction: column; gap: var(--space-1); position: sticky; top: var(--space-3); }
.admin-menu-item { padding: var(--space-2) var(--space-3); color: var(--color-text); font-weight: 600; border-radius: var(--radius-small); }
.admin-menu-item:hover { text-decoration: none; background: var(--color-surface-alt); }
.admin-menu-item.is-selected { color: var(--color-on-accent); background: var(--color-accent); }
.admin-menu-item:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-focus); }
@media (max-width: 48rem) {
  .admin-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
  .admin-menu { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .admin-menu-item { white-space: nowrap; }
}
.perf-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); }
.perf-toolbar p { margin: 0; }
.perf-actions { display: flex; gap: var(--space-2); }
.perf-actions .button { width: auto; }
.perf-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--space-4); }
.perf-cards > .settings-section + .settings-section { margin-top: 0; }
.table-scroll { overflow-x: auto; margin: 0 calc(-1 * var(--space-1)); }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--font-size-small); font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: var(--space-1) var(--space-2); text-align: left; vertical-align: top; border-bottom: 1px solid var(--color-border); }
.data-table th { color: var(--color-muted); font-weight: 600; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; white-space: nowrap; }
.perf-name, .perf-time { white-space: nowrap; }
.perf-name { font-family: var(--font-mono); }
.perf-many .perf-queries { color: var(--color-error); font-weight: 700; }
.perf-many { background: var(--color-error-bg); }
.perf-query { min-width: 16rem; max-width: 40rem; }
#perf-tune .field-input { max-width: 12rem; }
.perf-query-text { display: block; width: 100%; padding: 0; font: inherit; color: inherit; text-align: left; background: none; border: 0; cursor: pointer; }
.perf-query-text code { display: block; font-family: var(--font-mono); font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perf-query-text.is-open code { white-space: pre-wrap; overflow-wrap: anywhere; }
.perf-query-text:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-focus); border-radius: var(--radius-small); }
.key-values { display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-3); margin: 0; font-variant-numeric: tabular-nums; }
.key-values dt { color: var(--color-muted); }
.key-values dd { margin: 0; text-align: right; font-weight: 600; }

/* Charts (View.Components.Chart): an SVG that stretches with HTML labels around it */
.chart-grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: var(--space-3) var(--space-4); }
.chart { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.chart-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-1) var(--space-3); }
.chart-title { margin: 0; font-size: 0.9375rem; font-weight: 600; }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); font-size: var(--font-size-small); color: var(--color-muted); }
.chart-key { display: inline-flex; align-items: center; gap: 0.35rem; }
.chart-latest { color: var(--color-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-swatch { display: inline-block; width: 0.8rem; height: 3px; border-radius: 2px; background: currentColor; }
.chart-plot { position: relative; }
.chart-max { position: absolute; top: 2px; left: var(--space-1); padding: 0 0.25rem; line-height: 1.3; background: var(--color-surface-alt); border-radius: 3px; font-size: 0.75rem; color: var(--color-muted); font-variant-numeric: tabular-nums; pointer-events: none; }
.chart-svg { display: block; width: 100%; height: 8rem; background: var(--color-surface-alt); border-radius: var(--radius-small); }
.chart-grid line { stroke: var(--color-border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.line-main { color: var(--color-accent); stroke: var(--color-accent); }
.line-second { color: var(--color-mention); stroke: var(--color-mention); }
.line-warning { color: var(--color-error); stroke: var(--color-error); }
.line-limit { color: var(--color-muted); stroke: var(--color-muted); stroke-dasharray: 6 4; }
.chart-times { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--color-muted); font-variant-numeric: tabular-nums; }
.chart-figure { justify-content: center; padding: var(--space-3); background: var(--color-surface-alt); border-radius: var(--radius-small); }
.chart-figure-value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pool-advice { margin: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-small); border-left: 4px solid; }
.pool-advice.is-warning { color: var(--color-text); background: var(--color-error-bg); border-color: var(--color-error); }
.pool-advice.is-info { color: var(--color-text); background: var(--color-highlight); border-color: var(--color-create-hover); }
.pool-advice.is-ok { color: var(--color-text); background: var(--color-success-bg); border-color: var(--color-success); }

/* Profiling: flame graph bars coloured by package, light in light themes and dark in dark ones */
.profile-help { margin: 0; }
.flame { position: relative; overflow: hidden; border-radius: var(--radius-small); background: var(--color-surface-alt); }
.flame-node {
  position: absolute; height: 21px; padding: 0 0.3rem; overflow: hidden;
  font: 600 0.75rem/21px var(--font-mono); color: var(--color-text); text-align: left; white-space: nowrap; text-overflow: ellipsis;
  border: 0; border-right: 1px solid var(--color-surface); border-radius: 2px; cursor: pointer;
}
.flame-node:hover { filter: brightness(0.92); }
.flame-node:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.flame-c0 { background: hsl(25 75% var(--flame-l)); }
.flame-c1 { background: hsl(45 75% var(--flame-l)); }
.flame-c2 { background: hsl(160 45% var(--flame-l)); }
.flame-c3 { background: hsl(200 60% var(--flame-l)); }
.flame-c4 { background: hsl(265 45% var(--flame-l)); }
.flame-c5 { background: hsl(340 55% var(--flame-l)); }
.flame-reset { width: auto; margin-bottom: var(--space-2); }
.profile-func code { display: block; font-family: var(--font-mono); font-size: 0.8125rem; white-space: nowrap; }
.profile-file { display: block; color: var(--color-muted); font-size: 0.75rem; }
.profile-report { max-height: 28rem; overflow: auto; margin: var(--space-2) 0 0; padding: var(--space-2); font: 0.75rem/1.45 var(--font-mono); background: var(--color-surface-alt); border-radius: var(--radius-small); }
#profile-report summary { cursor: pointer; }
#profile-report .button { width: auto; }
.profiles-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.profiles-actions .button, .profiles-hour-actions .button, #profiles-delete-cancel { width: auto; }
.profiles-hours, .profiles-files { margin: 0; padding: 0; list-style: none; }
.profiles-hour { padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
.profiles-hour:last-child { border-bottom: 0; }
.profiles-hour-main { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); }
.profiles-hour-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.profiles-hour-actions { display: flex; gap: var(--space-2); margin-left: auto; }
.profiles-files { margin-top: var(--space-2); padding-left: var(--space-3); font-size: var(--font-size-small); font-variant-numeric: tabular-nums; columns: 16rem; }

/* Signup wizard and About editing (plan/onboard) */

.password-field { position: relative; }
.password-field .field-input { width: 100%; padding-right: 4.5rem; }
.password-toggle {
  position: absolute; top: 50%; right: 0.4rem; transform: translateY(-50%);
  padding: 0.3rem 0.6rem; font: inherit; font-size: var(--font-size-small); font-weight: 600;
  background: transparent; color: var(--color-accent); border: 0; border-radius: var(--radius-small); cursor: pointer;
}
.password-toggle:hover { background: var(--color-secondary); }
.password-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-focus); }

.auth-or { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-4) 0 var(--space-3); color: var(--color-muted); font-size: var(--font-size-small); }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--color-border); }
#invite-code-form { text-align: left; }
#invite-code, #wizard-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.06em; text-transform: uppercase; }

.notice-warn { background: var(--color-highlight); color: var(--color-text); }
.notice-info { background: var(--color-surface-alt); color: var(--color-text); }
.button-small { padding: 0.35rem 0.75rem; font-size: var(--font-size-small); }

.wizard { max-width: 36rem; margin: 0 auto; }
.wizard .button-primary { width: auto; font-size: 1rem; }
.wizard-steps { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); margin: 0 0 var(--space-3); padding: 0; list-style: none; font-size: var(--font-size-small); color: var(--color-muted); }
.wizard-steps li + li::before { content: "›"; margin-right: var(--space-2); color: var(--color-border); }
.wizard-steps li.is-done { color: var(--color-text); }
.wizard-steps li.is-current { color: var(--color-accent); font-weight: 600; }
.wizard-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-4); }
.wizard-spacer { flex: 1; }
.wizard-person { display: flex; align-items: center; gap: var(--space-3); min-width: 0; margin: 0 0 var(--space-3); }
.wizard-person-name { font-weight: 600; }
.wizard-summary { margin: 0 0 var(--space-3); padding-left: var(--space-4); }
.wizard-summary li + li { margin-top: var(--space-1); }
.wizard-viewas { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0 0 var(--space-3); }
.wizard-created { background: var(--color-success-bg); color: var(--color-success); }
.wizard-photo { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center; }
.wizard-photo-avatar { position: relative; }

.about-group-title { margin: var(--space-4) 0 var(--space-2); font-size: 1rem; font-weight: 600; }
.about-row + .about-row { margin-top: var(--space-3); }
.about-row-main { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--space-2); align-items: end; }
.about-row-main .field { margin: 0; }
.about-row-checks { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); margin-top: var(--space-1); }
.about-row-checks .checkbox-label:has(input:disabled) { color: var(--color-muted); }
.about-editor > .button-small { margin-top: var(--space-2); }
.about-note { margin: var(--space-3) 0 0; }
.about-remove { background: transparent; border: 0; border-radius: 50%; color: var(--color-muted); cursor: pointer; }
.about-remove:hover { background: var(--color-secondary); color: var(--color-text); }
.about-birthday { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--space-2); }

.vis-picker { position: relative; display: inline-flex; align-items: center; }
.vis-picker .icon { position: absolute; left: 0.6rem; width: 1rem; height: 1rem; pointer-events: none; color: var(--color-accent); }
.vis-picker select {
  appearance: none;
  font: inherit; font-size: var(--font-size-small); font-weight: 600;
  padding: 0.62rem 1.6rem 0.62rem 1.95rem;
  border: 1px solid var(--color-border); border-radius: 999px;
  background: var(--color-surface) linear-gradient(45deg, transparent 50%, currentColor 50%) no-repeat right 0.8rem center / 0.35rem 0.35rem;
  color: var(--color-text); cursor: pointer;
}
.vis-picker select:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-focus); }

.about-preview { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-2) var(--space-3); margin: 0 0 var(--space-3); }
.about-preview dt { color: var(--color-muted); font-size: var(--font-size-small); padding-top: 0.1rem; }
.about-preview dd { display: flex; align-items: center; gap: var(--space-2); margin: 0; overflow-wrap: anywhere; }
.about-preview-vis { display: inline-flex; color: var(--color-muted); }
.about-preview-vis .icon { width: 0.9rem; height: 0.9rem; }

@media (max-width: 30rem) {
  .about-row-main { grid-template-columns: minmax(0, 1fr) auto; }
  .about-row-main .vis-picker { grid-row: 2; }
}
.about-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.about-details { margin: var(--space-3) 0 0; }
.about-save { width: auto; font-size: 1rem; }
.invite-balance { margin: 0 0 var(--space-3); }
.invite-create { align-self: flex-start; }
.invite-share { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.invite-qr { width: 10rem; height: 10rem; image-rendering: pixelated; background: #fff; border-radius: var(--radius-small); }
.invite-share-text { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.invite-code { margin-bottom: var(--space-2); font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; letter-spacing: 0.08em; }
.invite-link-row { display: flex; gap: var(--space-2); }
.invite-link-row .field-input { flex: 1; min-width: 0; }
@media (max-width: 30rem) {
  .invite-share { grid-template-columns: minmax(0, 1fr); justify-items: center; }
}

/* Manage System's onboarding tabs (plan/onboard O32-O34) */
.admin-modes { display: flex; flex-direction: column; gap: var(--space-2); }
.admin-mode { align-items: flex-start; gap: var(--space-2); font-size: inherit; }
.admin-mode input { margin-top: 0.25rem; accent-color: var(--color-accent); }
.admin-mode > span { display: flex; flex-direction: column; gap: 0.15rem; }
.admin-mode-title { font-weight: 600; }
.admin-rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: var(--space-3); }
.admin-number .field-input { max-width: 8rem; }
.admin-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2); margin: 0 0 var(--space-3); }
.admin-inline .field { margin: 0; }
/* Make an admin: the users matching what is typed, in a list under the field. */
.admin-promote-field { position: relative; }
.admin-promote-field .field-input { width: 18rem; max-width: 100%; }
.admin-matches { position: absolute; top: 100%; left: 0; z-index: 10; min-width: 100%; max-width: 90vw; margin: var(--space-1) 0 0; padding: var(--space-1); list-style: none; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.admin-match { display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: var(--space-1) var(--space-2); border: 0; border-radius: var(--radius-small); background: none; color: var(--color-text); font: inherit; text-align: left; cursor: pointer; }
.admin-match:hover:not(:disabled), .admin-match:focus-visible { background: var(--color-surface-alt); }
.admin-match:disabled { cursor: default; opacity: 0.6; }
.admin-match-name { white-space: nowrap; }
.invite-tree { margin: 0; padding: 0 0 0 var(--space-4); list-style: none; border-left: 1px solid var(--color-border); }
.invite-tree-root { padding-left: 0; border-left: 0; }
.invite-tree-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); padding: var(--space-1) 0; border-radius: var(--radius-small); }
.invite-tree-row.is-selected { background: var(--color-surface-alt); }
.invite-tree-toggle { width: 1.5rem; flex: none; padding: 0; background: none; border: 0; color: var(--color-muted); font: inherit; cursor: pointer; }
.invite-tree-person { display: inline-flex; align-items: center; gap: var(--space-2); padding: 0; background: none; border: 0; color: var(--color-text); font: inherit; text-align: left; cursor: pointer; }
.invite-tree-person:hover strong { text-decoration: underline; }
.invite-tree-meta { font-size: var(--font-size-small); }
.admin-person { margin: 0 0 var(--space-4); padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-small); }
.admin-person-title { display: flex; justify-content: space-between; margin: 0 0 var(--space-2); font-size: 1rem; }
.admin-row { display: flex; align-items: center; gap: var(--space-3); }
.admin-row .item-body { flex: 1; min-width: 0; text-align: left; }

/* Signup: whether the username is free (plan/onboard). */
.handle-free {
  color: var(--color-success);
}

.handle-bad {
  color: var(--color-error);
}

/* Manage System > Help: where a recovery code may go (plan/postgres S10). */
.help-contacts {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.help-contacts-none {
  color: var(--color-error);
}

.help-contact-list {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}
