/* Compact productivity UI with LuxNet’s blue-and-gold Lodge palette. */
:root {
  --bg: #edf2f8;
  --surface: #fffdf7;
  --surface-raised: #ffffff;
  --control-hover: #e6edf6;
  --text: #172b46;
  --muted: #566981;
  --line: #d4deea;
  --accent: #195494;
  --accent-text: #ffffff;
  --accent-soft: #dce9f8;
  --danger: #b8323c;
  --ok: #2f855a;
  --no: #c53030;
  --warn: #b7791f;
  --danger-soft: #fff0f1;
  --gold: #9b742c;
  --activity-reply: #167c80;
  --masthead: #102d52;
  --masthead-text: #f5f0df;
  --masthead-gold: #e1c47e;
  --masthead-hover: #213e62;
  --shadow: 0 1px 3px rgb(24 39 58 / 4%);
  --dialog-shadow: 0 16px 56px rgb(24 39 58 / 18%);
  --radius: 14px;
  --control-radius: 9px;
  --dialog-radius: 18px;
  --pill-radius: 999px;
  --control-size: 2.25rem;
  --icon-size: 1.125rem;
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --heading: var(--sans);
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  /* Rich text: highlight (--hl-*), text color (--tc-*) and code colors (--code-*); names are stored, never colors. */
  --hl-yellow: #fff0a3;
  --hl-green: #cdf1d4;
  --hl-blue: #d3e5ff;
  --hl-pink: #ffd6e8;
  --hl-orange: #ffdfbd;
  --tc-red: #c0262d;
  --tc-orange: #b0560a;
  --tc-green: #2b7a3a;
  --tc-blue: #1d5fbf;
  --tc-purple: #7a3db0;
  --tc-gray: #5f6b7a;
  --code-comment: #6b7a8c;
  --code-keyword: #8a3ab9;
  --code-string: #2b7a3a;
  --code-number: #b0560a;
  --code-title: #1d5fbf;
  --code-type: #a3366e;
  --code-attr: #86600a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1526;
    --surface: #121f35;
    --surface-raised: #1a2a43;
    --control-hover: #203550;
    --text: #e5edf8;
    --muted: #a4b4cd;
    --line: #2c3d55;
    --accent: #91bdf3;
    --accent-text: #13263f;
    --accent-soft: #203b60;
    --gold: #dfbd70;
    --activity-reply: #72d5d2;
    --shadow: 0 1px 3px rgb(0 0 0 / 12%);
    --dialog-shadow: 0 16px 56px rgb(0 0 0 / 40%);
    --danger: #ff9ba4;
    --ok: #6fd19a;
    --no: #ff6b6b;
    --warn: #f0c75e;
    --danger-soft: #442b32;
    --hl-yellow: #5b4d12;
    --hl-green: #1f4a2b;
    --hl-blue: #1f3c66;
    --hl-pink: #5a2742;
    --hl-orange: #5c3816;
    --tc-red: #ff8f8f;
    --tc-orange: #ffb470;
    --tc-green: #84d895;
    --tc-blue: #93bcff;
    --tc-purple: #cfa8ff;
    --tc-gray: #aab5c4;
    --code-comment: #8d9cb2;
    --code-keyword: #d6aaff;
    --code-string: #9ddba6;
    --code-number: #ffb470;
    --code-title: #93bcff;
    --code-type: #ff9fcb;
    --code-attr: #e8c47c;
  }
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--sans);
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
h1,
h2,
.panel-title,
.logo,
.section-title {
  font-family: var(--heading);
  letter-spacing: -.015em;
}
h1 {
  font-size: 1.55rem;
  margin: 0 0 0.6rem;
}
h2 {
  font-size: 1.05rem;
  margin: 0 0 0.6rem;
}
h1::before,
h2::before {
  content: '';
  color: var(--accent);
}
p {
  margin: 0 0 0.75rem;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- frame ---------- */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding: 0.85rem 1rem;
  background: var(--masthead);
  border-bottom: 2px solid var(--masthead-gold);
  box-shadow: var(--shadow);
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--masthead-text);
}
.logo:hover {
  text-decoration: none;
}
.logo-mark {
  display: block;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  color: var(--masthead-gold);
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  font-family: var(--sans);
  font-size: 0.9rem;
}
.nav a {
  padding: 0.3rem 0.6rem;
  border-radius: var(--control-radius);
  color: var(--masthead-text);
}
.nav a:hover {
  background: var(--accent-soft);
  color: var(--text);
  text-decoration: none;
}
.nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.badge {
  display: inline-block;
  min-width: 1.3em;
  margin-left: 0.35em;
  padding: 0 0.35em;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.75rem;
  text-align: center;
}
.frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: 1rem;
  max-width: 68rem;
  margin: var(--space-5) auto;
  padding: 0 1rem;
}
.frame.frame-no-sidebar { grid-template-columns: minmax(0, 1fr); }
.frame-solo {
  grid-template-columns: minmax(0, 1fr);
  max-width: 30rem;
}
.foot {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font: 0.8rem var(--sans);
}
@media (max-width: 760px) {
  .frame {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- surfaces ---------- */
.card,
.panel {
  box-shadow: var(--shadow);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}
.panel {
  padding: var(--space-4);
  font-size: 0.9rem;
}
.panel-title {
  margin: 0 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--muted);
}
.panel-title::before {
  content: none;
}
.section-title {
  margin: 1.25rem 0 0.5rem;
}
.plain {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
}
.plain li {
  padding: 0.15rem 0;
}
.dot {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: var(--accent);
}
.on {
  color: var(--accent);
}
.tag {
  display: inline-block;
  margin-right: 0.4em;
  padding: 0 0.4em;
  border: 1px solid var(--line);
  border-radius: 3px;
  font: 0.72rem var(--sans);
  color: var(--muted);
  vertical-align: middle;
}
.tag::before, .tag::after { content: none; }
.tag-on {
  color: var(--accent);
  border-color: var(--accent);
}
.crumbs {
  font: 0.85rem var(--sans);
  color: var(--muted);
}
.error,
.notice {
  padding: 0.5rem 0.75rem;
  border-radius: var(--control-radius);
}
.error {
  background: var(--danger-soft);
  color: var(--danger);
}
.notice {
  background: var(--accent-soft);
}

/* ---------- forms ---------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
}
.stack > button {
  align-self: flex-start;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.row.spread {
  justify-content: space-between;
}
.row > input:not([type='file']) {
  flex: 1;
}
label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
  font-weight: 600;
}
label.check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}
.hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
}
input,
textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
input[type='checkbox'] {
  width: auto;
}
input[type='radio'] {
  width: 1rem;
  height: 1rem;
  padding: 0;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}
input[type='file'] {
  width: auto;
  max-width: 100%;
  flex: 1;
  padding: 0.3rem;
  font-size: 0.85rem;
}
textarea {
  resize: vertical;
}
input:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
button,
.button {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: var(--control-radius);
  background: var(--accent);
  color: var(--accent-text);
  font: 600 0.9rem var(--sans);
  cursor: pointer;
}
button:hover,
.button:hover {
  filter: brightness(1.1);
  text-decoration: none;
}
button.secondary,
.button.secondary {
  background: transparent;
  color: var(--accent);
}
button.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
}
button.link.muted {
  color: var(--muted);
  font-size: 0.85rem;
}
.narrow {
  margin-top: 2rem;
}

/* ---------- people ---------- */
.avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 1.1rem var(--sans);
  object-fit: cover;
}
.avatar-sm {
  width: 1.8rem;
  height: 1.8rem;
  font-size: 0.85rem;
}
.avatar-lg {
  width: 6rem;
  height: 6rem;
  font-size: 2.5rem;
}
.user {
  font-weight: 600;
}
.people {
  list-style: none;
  margin: 0;
  padding: 0;
}
.people li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
}
.people li:first-child {
  border-top: 0;
}
.profile {
  display: flex;
  gap: 1rem;
}
.profile-body {
  min-width: 0;
  flex: 1;
}
@media (max-width: 480px) {
  .profile {
    flex-direction: column;
  }
}

/* ---------- feed ---------- */
.rich {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0.4rem 0;
}
.post-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.post-image {
  display: block;
  max-width: 100%;
  max-height: 32rem;
  margin: 0.5rem 0;
  border-radius: var(--control-radius);
}
.post-foot {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.6rem;
}
.chip {
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 0.85rem var(--sans);
}
.chip-on {
  border-color: var(--accent);
  color: var(--accent);
}
.comment {
  display: flex;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  font: 0.9rem var(--sans);
}
.tabs a {
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  color: var(--text);
}
.tabs a.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.pager {
  display: flex;
  justify-content: space-between;
  margin: 0.75rem 0;
  font: 0.9rem var(--sans);
}

/* ---------- boards ---------- */
.listing {
  width: 100%;
  border-collapse: collapse;
}
.listing th {
  padding: 0.3rem 0.5rem;
  border-bottom: 2px solid var(--line);
  font: 0.75rem var(--sans);
  text-transform: uppercase;
  text-align: left;
  color: var(--muted);
}
.listing td {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.listing .num {
  width: 5rem;
  text-align: right;
  font-family: var(--sans);
}
.listing .title {
  font-weight: 600;
}
.reply {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 1rem;
}
.reply-author {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding-right: 0.75rem;
  border-right: 1px solid var(--line);
  overflow-wrap: anywhere;
}
@media (max-width: 560px) {
  .reply {
    grid-template-columns: minmax(0, 1fr);
  }
  .reply-author {
    flex-direction: row;
    align-items: center;
    border-right: 0;
  }
}

/* ---------- chat and messages ---------- */
.chat-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10rem;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.chat-log {
  height: 24rem;
  margin: 0;
  padding: 0.5rem 0.75rem;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--bg);
  font: 0.9rem/1.6 var(--sans);
}
.chat-text {
  overflow-wrap: anywhere;
}
.chat-people {
  font-size: 0.9rem;
}
@media (max-width: 560px) {
  .chat-cols {
    grid-template-columns: minmax(0, 1fr);
  }
}
.dm-log {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 28rem;
  margin-bottom: 0.75rem;
  overflow-y: auto;
}
.dm {
  align-self: flex-start;
  max-width: 80%;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}
.dm-mine {
  align-self: flex-end;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dm .rich {
  margin: 0;
}
.convo {
  flex: 1;
  min-width: 0;
  color: var(--text);
}
.convo:hover {
  text-decoration: none;
}
.clip {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.unread strong,
.notes .unread a {
  color: var(--accent);
}
.unread::before {
  content: '●';
  color: var(--accent);
  margin-right: 0.3rem;
}
.invites code {
  display: inline-block;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  background: var(--bg);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.invites code.copied {
  outline: 2px solid var(--accent);
}

/* ---------- rich-text editor and formatted post bodies ---------- */
.editor-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
/* The editor's own chrome (toolbar, menus, link row, upload progress) is in editor/editor.css, built into
   /static/vendor/plumbline-editor.css. What written text looks like is here, shared by the editor and by
   rendered posts, messages and pages (the stored forms are listed in docs/plans/rich-text-editor.md, section 4).
   Highlight, text color and code colors are fixed names mapped to the --hl-*, --tc-* and --code-* tokens. */
.rich-text {
  overflow-wrap: anywhere;
}
.rich-text.body {
  margin: 0.4rem 0;
}
.rich-text p {
  margin: 0 0 0.6rem;
}
.rich-text p:last-child,
.rich-text li > p,
.rich-text td > p,
.rich-text th > p {
  margin-bottom: 0;
}
/* A paragraph left empty on purpose is a blank line. */
.rich-text p:empty {
  min-height: 1.5em;
}
/* Title, Heading and Subheading (h2-h4); the older editor's single heading (h1) looks like the Title. */
.rich-text h1,
.rich-text h2 {
  font-size: 1.2rem;
  margin: 0.7rem 0 0.3rem;
}
.rich-text h3 {
  font-size: 1.07rem;
  margin: 0.6rem 0 0.25rem;
}
.rich-text h4 {
  font-size: 0.97rem;
  margin: 0.5rem 0 0.2rem;
  color: var(--muted);
}
.rich-text > :is(h1, h2, h3, h4):first-child {
  margin-top: 0;
}
.rich-text :is(h1, h2, h3, h4)::before {
  content: none;
  display: none;
}
.rich-text a {
  text-decoration: underline;
}
/* A mention of a member (@Name): a quiet accent chip, in posts and while writing. */
.rich-text a[data-mention] {
  padding: 0 0.2em;
  border-radius: 0.35em;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.rich-text a[data-mention]:hover,
.rich-text a[data-mention]:focus-visible {
  text-decoration: underline;
}
.rich-text blockquote {
  margin: 0.4rem 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.rich-text pre {
  padding: 0.5rem 0.75rem;
  border-radius: var(--control-radius);
  background: var(--bg);
  border: 1px solid var(--line);
  font: 0.85rem var(--mono);
  white-space: pre-wrap;
}
.rich-text code {
  padding: 0.05em 0.3em;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  font: 0.88em var(--mono);
}
.rich-text pre code {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
}
.rich-text ul,
.rich-text ol {
  margin: 0.4rem 0;
  padding-left: 1.4rem;
}
.rich-text hr {
  margin: 0.9rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.rich-text figure {
  margin: 0.5rem 0;
}
.rich-text img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 36rem;
  border-radius: var(--control-radius);
}
.rich-text figcaption {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.rich-text figure[data-width='25'] { max-width: 25%; }
.rich-text figure[data-width='50'] { max-width: 50%; }
.rich-text figure[data-width='75'] { max-width: 75%; }

/* Members' own video and sound (figure[data-media]): the browser's player, never starting by itself. */
.rich-text figure[data-media] video {
  display: block;
  width: 100%;
  max-height: 70vh;
  border-radius: var(--control-radius);
  background: #0b1420;
}
/* No poster picture: a calm dark panel in the usual video shape instead of an empty box. */
.rich-text figure[data-media='video'] video:not([poster]) {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #16263c, #0b1420);
}
.rich-text figure[data-media='audio'] audio {
  display: block;
  width: 100%;
  max-width: 36rem;
}

/* Video cards (YouTube, Vimeo): our stored picture, the title and a play button. The player itself is only added by
   public/app.js after play is pressed; without scripts the card is its title link. */
.video-card {
  max-width: 36rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.video-card-play {
  position: relative;
  display: none;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: linear-gradient(135deg, #16263c, #0b1420);
  cursor: pointer;
}
.plb-js .video-card-play { display: block; }
.video-card-play .video-card-thumb {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border-radius: 0;
}
.video-card-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  margin: auto;
  border-radius: 50%;
  background: rgb(8 14 24 / 0.72);
  color: #fff;
}
.video-card-play:hover .video-card-icon,
.video-card-play:focus-visible .video-card-icon { background: var(--accent); }
.video-card-play:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.video-card-title {
  display: block;
  padding: var(--space-2) var(--space-3) 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.video-card-note {
  display: block;
  padding: 2px var(--space-3) var(--space-2);
  color: var(--muted);
  font-size: 0.85rem;
}
.video-player {
  max-width: 36rem;
  aspect-ratio: 16 / 9;
}
.video-player iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--radius);
  background: #0b1420;
}

/* Alignment (data-align; left is the default). */
.rich-text [data-align='center'] { text-align: center; }
.rich-text [data-align='right'] { text-align: right; }
.rich-text [data-align='justify'] { text-align: justify; }
.rich-text figure[data-align='center'] { margin-inline: auto; }
.rich-text figure[data-align='center'] img { margin-inline: auto; }
.rich-text figure[data-align='right'] { margin-left: auto; }
.rich-text figure[data-align='right'] img { margin-left: auto; }

/* Highlight and text color: fixed names, colors from tokens (light and dark). */
.rich-text mark {
  padding: 0 0.1em;
  border-radius: 3px;
  background: var(--hl-yellow);
  color: inherit;
}
.rich-text mark[data-color='green'] { background: var(--hl-green); }
.rich-text mark[data-color='blue'] { background: var(--hl-blue); }
.rich-text mark[data-color='pink'] { background: var(--hl-pink); }
.rich-text mark[data-color='orange'] { background: var(--hl-orange); }
.rich-text span[data-color='red'] { color: var(--tc-red); }
.rich-text span[data-color='orange'] { color: var(--tc-orange); }
.rich-text span[data-color='green'] { color: var(--tc-green); }
.rich-text span[data-color='blue'] { color: var(--tc-blue); }
.rich-text span[data-color='purple'] { color: var(--tc-purple); }
.rich-text span[data-color='gray'] { color: var(--tc-gray); }

/* Checklists: the box is drawn here, read-only (the editor shows a real checkbox instead). */
.rich-text ul[data-type='taskList'] {
  padding-left: 0.1rem;
  list-style: none;
}
.rich-text li[data-type='taskItem'] {
  position: relative;
  padding-left: 1.7rem;
}
.rich-text li[data-type='taskItem']::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.22em;
  width: 1.05em;
  height: 1.05em;
  border: 1.5px solid var(--muted);
  border-radius: 4px;
  background: var(--surface);
}
.rich-text li[data-type='taskItem'][data-checked='true']::before {
  border-color: var(--accent);
  background: var(--accent);
}
.rich-text li[data-type='taskItem'][data-checked='true']::after {
  content: '';
  position: absolute;
  left: 0.37em;
  top: 0.38em;
  width: 0.3em;
  height: 0.55em;
  border: solid var(--accent-text);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.rich-text li[data-type='taskItem'][data-checked='true'] > p {
  color: var(--muted);
  text-decoration: line-through;
}

/* Tables scroll sideways inside the text on narrow screens rather than widening the page. */
.rich-text table {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 0.6rem 0;
  overflow-x: auto;
  border-collapse: collapse;
}
.rich-text :is(td, th) {
  min-width: 4rem;
  max-width: 20rem;
  overflow-wrap: break-word; /* words stay whole; the table scrolls instead */
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}
.rich-text th {
  background: var(--bg);
  font-weight: 600;
}

/* A document shown as a card: name, then its kind and size (added when shown, never stored). */
.rich-text a[data-attachment='file'] {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem 0.6rem;
  flex-wrap: wrap;
  max-width: 100%;
  margin: 0.15rem 0;
  padding: 0.45rem 0.75rem 0.45rem 2.1rem;
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface-raised);
  color: var(--text);
  text-decoration: none;
  vertical-align: middle;
}
.rich-text a[data-attachment='file']::before {
  content: '';
  position: absolute;
  left: 0.75rem;
  top: 50%;
  width: 0.8rem;
  height: 1rem;
  margin-top: -0.5rem;
  border: 1.5px solid var(--accent);
  border-radius: 2px 5px 2px 2px;
}
.rich-text a[data-attachment='file']:hover {
  background: var(--control-hover);
}
.file-card-name {
  font-weight: 600;
}
.file-card-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Code colors, added when a code block with a language is shown (src/lib/rich-render.ts). */
.rich-text .hljs-comment,
.rich-text .hljs-quote { color: var(--code-comment); font-style: italic; }
.rich-text .hljs-keyword,
.rich-text .hljs-selector-tag,
.rich-text .hljs-meta .hljs-keyword,
.rich-text .hljs-doctag { color: var(--code-keyword); }
.rich-text .hljs-string,
.rich-text .hljs-regexp,
.rich-text .hljs-addition,
.rich-text .hljs-meta .hljs-string { color: var(--code-string); }
.rich-text .hljs-number,
.rich-text .hljs-literal,
.rich-text .hljs-symbol,
.rich-text .hljs-bullet { color: var(--code-number); }
.rich-text .hljs-title,
.rich-text .hljs-section,
.rich-text .hljs-name,
.rich-text .hljs-selector-id,
.rich-text .hljs-selector-class { color: var(--code-title); }
.rich-text .hljs-built_in,
.rich-text .hljs-type,
.rich-text .hljs-class .hljs-title,
.rich-text .hljs-title.class_ { color: var(--code-type); }
.rich-text .hljs-attr,
.rich-text .hljs-attribute,
.rich-text .hljs-variable,
.rich-text .hljs-template-variable,
.rich-text .hljs-property,
.rich-text .hljs-params { color: var(--code-attr); }
.rich-text .hljs-meta,
.rich-text .hljs-tag { color: var(--code-comment); }
.rich-text .hljs-deletion { color: var(--tc-red); }
.rich-text .hljs-emphasis { font-style: italic; }
.rich-text .hljs-strong { font-weight: 700; }

/* ---------- comments that open under a post ---------- */
.comments {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
}
.comments .comment:first-child {
  border-top: 0;
  padding-top: 0;
}
.comments .comment-form {
  margin-top: 0.6rem;
}
.comments .error {
  margin: 0 0 0.5rem;
}

/* One gavel asset for page headings, subsection labels and disclosures. */
h1::before,
h2::before,
.page-heading-mark,
.twisty {
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  margin-right: 0.45em;
  vertical-align: -0.1em;
  background-color: currentColor;
  -webkit-mask: url('/static/gavel.svg') center / contain no-repeat;
  mask: url('/static/gavel.svg') center / contain no-repeat;
}
/* Disclosure gavels rotate when expanded, preserving a visible state cue. */
.twisty {
  transition: transform 0.12s;
}
[aria-expanded='true'] > .twisty {
  transform: rotate(90deg);
}
[aria-expanded='true'] {
  color: var(--accent);
  border-color: var(--accent);
}
@media (prefers-reduced-motion: reduce) {
  .twisty {
    transition: none;
  }
}

/* Clicking a post's message or header opens its comments. */
[data-comments-body] {
  cursor: pointer;
}

/* Page headings link to their parent across the whole heading area. */
.page-heading {
  flex: 1;
  min-width: 0;
}
.page-heading::before {
  content: none;
}
.page-heading {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}
.page-heading > a {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  color: inherit;
}
/* The visible close/back icon every screen shows beside its heading. */
.page-heading-control {
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 1rem;
  font-weight: 400;
}
.page-heading-mark {
  color: var(--gold);
}

.page-heading > a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Threads open inside the board listing. */
[data-board-row],
[data-roster-row],
[data-board-thread-row] {
  cursor: pointer;
}
/* One highlight for every large click target, in both color themes. */
:is(.page-heading > a, [data-board-row], [data-roster-row], [data-board-thread-row], [data-comments-body], :is(.composer, .admin-section) > summary):hover,
:is(.composer, .admin-section) > summary:focus-visible,
.page-heading > a:focus-visible,
[data-board-row]:focus-within,
[data-roster-row]:focus-within,
[data-board-thread-row]:focus-within {
  background: var(--accent-soft);
}
.board-thread-panel > td {
  padding: 0.75rem 0;
}
[data-board-thread-panel] {
  min-width: 0;
  overflow-wrap: anywhere;
}
[data-board-thread-panel] .card:last-child {
  margin-bottom: 0;
}

/* Community activity is a quiet, single-line link rather than a post card. */
.feed-activity {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  min-height: var(--control-size);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
  border-bottom: 1px solid var(--line);
  border-radius: var(--control-radius);
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.feed-activity { --activity-icon: var(--accent); }
.feed-activity[data-feed-activity='member'] { --activity-icon: var(--gold); }
.feed-activity[data-feed-activity='reply'] { --activity-icon: var(--activity-reply); }
.feed-activity > svg {
  flex: 0 0 auto;
  width: var(--icon-size);
  height: var(--icon-size);
  color: var(--activity-icon);
}
.feed-activity-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.feed-activity-time { flex: 0 0 auto; font-size: 0.9em; }
.feed-activity:hover, .feed-activity:focus-visible { background: var(--accent-soft); color: var(--text); text-decoration: none; }
.feed-activity:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The feed composer starts as one compact, keyboard-accessible disclosure. */
:is(.composer, .admin-section) > summary {
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  border-radius: var(--control-radius);
}
:is(.composer, .admin-section) > summary::-webkit-details-marker {
  display: none;
}
:is(.composer, .admin-section) > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
:is(.composer, .admin-section)[open] > summary {
  margin-bottom: 0.75rem;
}
:is(.composer, .admin-section)[open] > summary > .twisty {
  transform: rotate(90deg);
}


/* Native disclosures keep each admin group closed until explicitly opened. */
.admin-section > summary h2 {
  display: inline;
  margin: 0;
}
.admin-section > summary h2::before {
  content: none;
}

[data-edit-message] {
  cursor: pointer;
}
[data-edit-message]:not([data-editing]):hover,
[data-edit-message]:focus-visible {
  background: var(--accent-soft);
}
[data-edit-message]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[data-edit-message][data-editing] {
  cursor: auto;
}

/* Compact thread actions retain comfortable pointer and touch targets. */
.thread-actions {
  gap: 0.35rem;
}
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-size);
  height: var(--control-size);
  padding: 0;
  border-color: transparent;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--muted);
  flex-shrink: 0;
}
.icon-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.chip > svg {
  vertical-align: middle;
}
.icon-button:hover,
.icon-button:focus-visible,
.icon-active {
  background: var(--accent-soft);
  filter: none;
}
.icon-danger {
  color: var(--danger);
}
.icon-danger:hover,
.icon-danger:focus-visible {
  background: var(--danger-soft);
}
@media (pointer: coarse) {
  .icon-button {
    width: 2.75rem;
    height: 2.75rem;
  }
}

.resource-access {
  margin: 0.5rem 0 1rem;
}
fieldset {
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
}
.group-member-list {
  max-height: 24rem;
  overflow-y: auto;
}

/* Group management: a permanent all-user roster beside ordered group cards. */
.group-manager-toolbar,
.group-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}
.group-manager-toolbar { margin: 0.75rem 0; }
.group-manager-toolbar > label { flex: 1; min-width: 12rem; }
.group-manager-status { min-height: 1.5em; margin: 0.5rem 0; }
.group-manager-layout {
  display: grid;
  grid-template-columns: minmax(14rem, 0.85fr) minmax(0, 1.4fr);
  align-items: start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.group-user-roster,
.group-manager-card {
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.group-user-roster { position: sticky; top: 1rem; }
.group-user-roster h3,
.group-card-heading h3 { margin: 0 0 0.35rem; font: 600 1.1rem var(--heading); overflow-wrap: anywhere; }
.group-card-heading { flex: 1; min-width: 7rem; }
.group-card-heading p { margin: 0; overflow-wrap: anywhere; }
.group-card-actions { gap: 0.2rem; }
.group-card-list { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }
.group-manager-card { position: relative; }
.group-user-list { max-height: 24rem; overflow-y: auto; margin-top: 0.5rem; }
.group-user-roster .group-user-list { max-height: 34rem; }
.plain .group-user-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.4rem;
  border-top: 1px solid var(--line);
  cursor: grab;
}
.plain .group-user-card[hidden] { display: none; }
.group-user-card:hover { background: var(--accent-soft); }
.group-user-grip { color: var(--muted); flex-shrink: 0; }
.group-user-info { flex: 1; min-width: 5rem; overflow-wrap: anywhere; }
.group-user-info > span { display: block; }
.group-user-add { display: flex; gap: 0.25rem; width: 100%; padding-left: 1.4rem; align-items: center; }
.group-membership-picker { width: 100%; min-width: 0; font-size: 0.85rem; cursor: default; }
.group-membership-picker > summary { display: flex; align-items: center; gap: var(--space-1); padding: var(--space-2); border: 1px solid var(--line); border-radius: var(--control-radius); list-style: none; cursor: pointer; background: var(--surface); }
.group-membership-picker > summary::-webkit-details-marker { display: none; }
.group-membership-picker > summary:hover, .group-membership-picker > summary:focus-visible { background: var(--accent-soft); }
.group-membership-picker > summary:focus-visible { outline: 2px solid var(--accent); }
.group-membership-picker[open] > summary > .twisty { transform: rotate(90deg); }
.group-membership-options { padding: var(--space-2); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--control-radius) var(--control-radius); background: var(--surface-raised); }
.group-membership-options .check { padding-block: var(--space-2); cursor: pointer; overflow-wrap: anywhere; }
.group-membership-options .check:hover, .group-membership-options .check:focus-within { background: var(--accent-soft); }
.group-drag-handle { cursor: grab; }
.group-drag-handle:active { cursor: grabbing; }
.group-drop-target { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: -2px; }
.group-drop-before::before,
.group-drop-after::after { content: ''; position: absolute; left: 0; right: 0; height: 3px; background: var(--accent); pointer-events: none; }
.group-drop-before::before { top: -5px; }
.group-drop-after::after { bottom: -5px; }
[data-group-manager][aria-busy='true'] { opacity: 0.8; }
@media (max-width: 1000px) {
  .group-manager-layout { grid-template-columns: minmax(0, 1fr); }
  .group-user-roster { position: static; }
  .group-user-roster .group-user-list { max-height: 20rem; }
}

/* Calendar: quiet chrome, compact sidebar, segmented views and spacious date grid. */
.calendar-shell { padding: 1.25rem; font-family: var(--sans); }
.cal-toolbar, .cal-period { display: flex; align-items: center; gap: .7rem; }
.cal-toolbar { justify-content: space-between; flex-wrap: wrap; margin-bottom: 1.25rem; }
.cal-period h2 { margin: 0; font-family: var(--sans); font-size: 1.65rem; letter-spacing: -.04em; }
.cal-period h2::before { content: none; }
.cal-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-sidebar { background: var(--bg); padding: 1rem .75rem; border-right: 1px solid var(--line); }
.cal-sidebar h3 { font: 600 .9rem var(--sans); margin-top: 1.75rem; }
.cal-mini-title { font-size: .85rem; font-weight: 650; text-align: center; margin-bottom: .75rem; }
.cal-mini { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; font-size: .7rem; text-align: center; }
.cal-mini a, .cal-mini span { display: grid; place-items: center; min-height: 23px; text-decoration: none; border-radius: 50%; }
.cal-selected { outline: 1px solid var(--accent); }
.cal-today { background: var(--accent); color: var(--accent-text) !important; border-radius: 50%; }
.cal-outside { opacity: .55; }
.cal-content { min-width: 0; }
.cal-view-tabs { display: flex; width: fit-content; max-width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; margin: 1rem auto; padding: 3px; }
.cal-view-tabs a { padding: .35rem .85rem; border-radius: var(--control-radius); color: var(--muted); text-decoration: none; font-size: .85rem; }
.cal-view-tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekday { text-align: right; padding: .4rem .6rem; font-size: .72rem; color: var(--muted); text-transform: uppercase; }
.cal-day { min-height: 112px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); padding: 4px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day-selected { background: var(--accent-soft); }
.cal-day-top { display: flex; justify-content: space-between; flex-direction: row-reverse; align-items: center; }
.cal-day-number { display: grid; place-items: center; width: 28px; height: 28px; font-size: .82rem; text-decoration: none; color: var(--text); }
.cal-quick-add { display: grid; place-items: center; width: 24px; height: 28px; text-decoration: none; opacity: .5; }
.cal-quick-add:hover, .cal-quick-add:focus { opacity: 1; background: var(--accent-soft); }
.cal-event { display: block; border-radius: var(--control-radius); padding: 3px 5px; margin: 3px 0; font-size: .72rem; line-height: 1.35; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid var(--event-color); background: var(--accent-soft); color: var(--text); }
.cal-event:hover { filter: brightness(.94); text-decoration: underline; }
.cal-time { font-weight: 650; }
.cal-color-blue { --event-color: #337cde; }
.cal-color-purple { --event-color: #a16ad9; }
.cal-color-green { --event-color: #32956c; }
.cal-color-orange { --event-color: #d58a24; }
.cal-color-red { --event-color: #dc5961; }
.cal-more { display: block; padding: 2px 4px; }
.cal-agenda { padding: 0 1rem 1rem; }
.cal-agenda-day { display: grid; grid-template-columns: 115px minmax(0, 1fr); border-top: 1px solid var(--line); padding: .75rem 0; gap: .75rem; }
.cal-agenda-day h3 { margin: 0; font: 600 .85rem var(--sans); }
.cal-agenda .cal-event { white-space: normal; font-size: .9rem; }
.cal-empty { padding: 2rem 1rem; text-align: center; }
.cal-schedule { overflow: auto; max-height: 680px; }
.cal-schedule-grid { display: grid; grid-template-columns: 48px repeat(var(--cal-columns), minmax(90px, 1fr)); }
.cal-schedule-heading, .cal-hours-heading { text-align: center; padding: .65rem .1rem; border-bottom: 1px solid var(--line); font-size: .8rem; background: var(--surface); }
.cal-today-heading { color: var(--accent); font-weight: 700; }
.cal-all-day, .cal-all-day-label { border-bottom: 1px solid var(--line); min-height: 45px; padding: 3px; }
.cal-hours { display: grid; grid-template-rows: repeat(24, 52px); font-size: .65rem; text-align: right; color: var(--muted); }
.cal-hours span { padding: 3px; }
.cal-timeline { display: grid; grid-template-rows: repeat(24, 52px); border-left: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent 51px, var(--line) 51px, var(--line) 52px); min-width: 0; }
.cal-timed-slot { min-width: 0; padding: 0 2px; align-self: start; }
.cal-timed-slot .cal-event { white-space: normal; overflow-wrap: anywhere; height: calc(100% - 6px); }
.cal-form, .cal-detail { max-width: 760px; }
.frame-calendar > .main > :is(.cal-form, .cal-detail) {
  --calendar-panel-gutter: clamp(.75rem, 3vw, 2rem);
  width: calc(100% - var(--calendar-panel-gutter) - var(--calendar-panel-gutter));
  margin: clamp(1rem, 4vw, 3rem) auto;
  padding: clamp(1rem, 3vw, 2rem);
  border-radius: var(--radius);
}
.cal-form-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.cal-form-dates > label { min-width: 0; }
.cal-detail-heading .page-heading { overflow-wrap: anywhere; }
.cal-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 1000px) { .cal-layout { grid-template-columns: minmax(0, 1fr); } .cal-sidebar { display: none; } }
@media (max-width: 600px) {
  .calendar-shell { padding: .65rem; }
  .cal-period h2 { font-size: 1.2rem; }
  .cal-toolbar, .cal-period { gap: .3rem; }
  .cal-day { min-height: 95px; padding: 2px; }
  .cal-event { font-size: .65rem; padding: 2px; }
  .cal-month .cal-time { display: none; }
  .cal-quick-add { display: none; }
  .cal-day-number { width: 24px; height: 24px; }
  .cal-view-tabs a { padding: .35rem .65rem; }
  .cal-form-dates { gap: .5rem; }
  .cal-agenda-day { grid-template-columns: 80px minmax(0, 1fr); }
}

/* Calendar owns the entire workspace below the main navigation. */
.calendar-page { min-height: 100dvh; display: flex; flex-direction: column; }
.frame.frame-calendar { grid-template-columns: minmax(0, 1fr); max-width: none; width: 100%; margin: 0; padding: 0; gap: 0; flex: 1; }
.frame-calendar > .main { min-width: 0; }
.frame-calendar .calendar-shell { min-height: 100%; display: flex; flex-direction: column; margin: 0; border: 0; border-radius: 0; }
.calendar-shell > .page-heading { flex: 0 0 auto; }
.frame-calendar .cal-layout { flex: 1; }
.frame-calendar .cal-content { display: flex; flex-direction: column; }
.frame-calendar .cal-month { flex: 1; grid-template-rows: auto repeat(6, minmax(112px, 1fr)); }
.frame-calendar .cal-schedule { max-height: none; }
@media (max-width: 600px) { .frame-calendar .cal-month { grid-template-rows: auto repeat(6, minmax(95px, 1fr)); } }

.cal-time-picker { min-width: 0; margin: 0; padding: 0; border: 0; }
.cal-time-picker legend { margin-bottom: .3rem; }
.cal-clock-controls { display: flex; align-items: center; gap: .35rem; }
.cal-clock-controls select { width: auto; flex: 1; min-width: 0; margin: 0; padding-left: .45rem; padding-right: .45rem; }
.cal-clock-controls select:last-child { flex: 1.25; }
.cal-duration { max-width: 260px; }
.cal-time-picker[hidden], .cal-duration[hidden] { display: none; }
.cal-color-picker { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; margin: 1rem 0; }
.cal-color-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.cal-color-choice { display: flex; flex-direction: row; align-items: center; gap: .4rem; cursor: pointer; margin: 0; padding: .35rem; border-radius: 5px; }
.cal-color-choice:has(input:checked) { background: var(--accent-soft); outline: 1px solid var(--accent); }
.cal-color-choice input { width: auto; margin: 0; }
.cal-color-swatch { width: 18px; height: 18px; border-radius: 50%; background: var(--event-color); border: 1px solid var(--line); flex-shrink: 0; }
.cal-custom-color { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; }
.cal-custom-color label { margin: 0; }
.cal-custom-color input[type=color] { width: 60px; min-height: 42px; padding: 3px; cursor: pointer; }
.cal-color-preview { margin-top: 1rem; padding: .65rem; font-size: .9rem; }
.cal-event { background: color-mix(in srgb, var(--event-color) 17%, var(--surface)); }
@media (max-width: 600px) { .cal-color-options { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cal-form-dates { grid-template-columns: 1fr; } }

.cal-color-picker > summary { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; cursor: pointer; }
.cal-color-fields { border: 0; margin: 1rem 0 0; padding: 0; min-width: 0; }

.cal-repeat { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; margin: 1rem 0; }
.cal-repeat-days { display: flex; gap: .5rem 1rem; flex-wrap: wrap; }
.cal-repeat-days label { margin: .3rem 0; }
.cal-repeat input[type=number] { max-width: 130px; }
.cal-repeat [hidden] { display: none; }
.cal-repeat-description { padding: .75rem; background: var(--accent-soft); border-radius: 6px; }

.cal-location { position: relative; }
.cal-location-results { position: absolute; top: 78px; left: 0; right: 0; z-index: 10; max-height: 260px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: .25rem; }
.cal-location-results[hidden] { display: none; }
.cal-location-results [role=option] { padding: .7rem; cursor: pointer; border-radius: var(--control-radius); overflow-wrap: anywhere; }
.cal-location-results [role=option]:hover, .cal-location-results [aria-selected=true] { background: var(--accent-soft); }

.cal-location-map { max-width: 640px; margin: .75rem 0 1.25rem; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--bg); }
.cal-location-map[hidden], .cal-location-map [hidden] { display: none; }
.cal-location-map img { display: block; width: 100%; height: auto; aspect-ratio: 8 / 3; object-fit: cover; }
.cal-location-map figcaption, .cal-location-map > p { padding: .5rem .75rem; margin: 0; }

.cal-time-zone-form { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.cal-time-zone-form label { margin: 0; min-width: 220px; max-width: 100%; }
.cal-time-zone-form select { margin-bottom: 0; max-width: 100%; }

.cal-event-delete { display: flex; align-items: center; gap: .5rem; margin: 0; max-width: 100%; }
.cal-event-delete label { min-width: 0; }
.cal-event-delete select { max-width: 100%; min-height: 36px; margin: 0; }
.cal-event-delete .icon-button { flex-shrink: 0; }

.cal-detail-heading { align-items: flex-start; margin-bottom: .6rem; }
.cal-detail-heading .page-heading { margin-bottom: 0; }

.cal-scope-choice { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; margin: 1rem 0; }
.cal-scope-choice label { padding: .5rem 0; justify-content: flex-start; gap: .65rem; line-height: 1.4; text-align: left; }

.cal-scope-dialog { width: min(440px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; padding: 1.4rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--dialog-shadow); }
.cal-scope-dialog:not([open]) { display: none; }
.cal-scope-dialog::backdrop { background: rgb(8 25 48 / 45%); backdrop-filter: blur(3px); }
.cal-scope-dialog h2 { font: 650 1.2rem var(--sans); margin: 0 0 .4rem; }
.cal-scope-dialog h2::before { display: none; }
.cal-scope-event-name { font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
.cal-scope-dialog .cal-scope-choice { padding: .25rem; margin: 1rem 0; }
.cal-scope-dialog .cal-scope-choice label { padding: .8rem .6rem; border-radius: 6px; cursor: pointer; }
.cal-scope-dialog .cal-scope-choice label:hover, .cal-scope-dialog .cal-scope-choice label:has(input:checked) { background: var(--accent-soft); }
.cal-scope-footer { justify-content: flex-end; }

.cal-time-zone-dialog .cal-time-zone-form { display: flex; flex-direction: column; align-items: stretch; gap: .75rem; margin: 1rem 0 0; }
.cal-time-zone-dialog .cal-time-zone-form label { min-width: 0; }
.cal-time-zone-dialog .cal-time-zone-form select { width: 100%; }
.cal-time-zone-dialog .cal-time-zone-form p { margin: 0; }

/* Kanban workspace: horizontal lists, quiet cards, a shared blue-lodge palette. */
.kb-directory { margin: 0; min-height: 100%; padding: 1.5rem; border: 0; border-radius: 0; }
.kb-board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.kb-theme-blue { --kb-color: #174f91; }
.kb-theme-purple { --kb-color: #7954a2; }
.kb-theme-green { --kb-color: #317962; }
.kb-theme-orange { --kb-color: #a56520; }
.kb-theme-red { --kb-color: #a9424b; }
.kb-theme-slate { --kb-color: #566981; }
.kb-board-tile { display: flex; flex-direction: column; gap: .6rem; min-height: 145px; padding: 1.1rem; border-radius: var(--radius); background: var(--kb-color); color: #fff; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.kb-board-tile:hover { text-decoration: none; filter: brightness(1.1); }
.kb-board-tile strong { font-size: 1.15rem; }
.kb-board-tile > span:last-child { opacity: .9; }
.kb-empty { padding: 3rem 0; text-align: center; color: var(--muted); }
.kb-workspace { padding: 1.25rem; min-height: 100%; background: color-mix(in srgb, var(--kb-color) 10%, var(--bg)); }
.kb-heading { align-items: flex-start; }
.kb-heading .page-heading { margin-bottom: .3rem; }
.kb-description { max-width: 900px; white-space: pre-wrap; overflow-wrap: anywhere; }
.kb-access { color: var(--muted); }
.kb-status { min-height: 1.5em; }
.kb-lists { display: flex; gap: 1rem; align-items: flex-start; overflow-x: auto; padding: .4rem .2rem 1.5rem; min-height: 480px; }
.kb-list { flex: 0 0 290px; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; box-shadow: var(--shadow); }
.kb-list-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.kb-list h2 { font: 650 .95rem var(--sans); margin: 0; overflow-wrap: anywhere; }
.kb-list h2::before { content: none; }
.kb-list-grip { cursor: grab; }
.kb-list-menu { margin: .25rem 0; }
.kb-list-menu > summary { cursor: pointer; list-style: none; color: var(--muted); width: fit-content; }
.kb-list-menu > summary::-webkit-details-marker { display: none; }
.kb-list-tools { padding: .5rem 0; }
.kb-list-tools > form { display: flex; align-items: flex-end; gap: .4rem; margin-bottom: .5rem; }
.kb-list-tools label { min-width: 0; }
.kb-card-stack { min-height: 75px; max-height: max(180px, calc(100dvh - 340px)); overflow-y: auto; padding: .25rem; }
.kb-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin: .5rem 0; box-shadow: 0 2px 4px rgb(0 0 0 / 5%); cursor: grab; }
.kb-card:hover { border-color: var(--accent); }
.kb-card-link { display: flex; flex-direction: column; gap: .5rem; color: var(--text); padding: .8rem .8rem .4rem; overflow-wrap: anywhere; }
.kb-card-link:hover { text-decoration: none; background: var(--accent-soft); border-radius: 8px 8px 0 0; }
.kb-card-link strong { font-size: .9rem; font-weight: 550; }
.kb-label { display: inline-block; align-self: flex-start; padding: .1rem .5rem; border-radius: var(--control-radius); color: #fff; font-size: .65rem; }
.kb-label-blue { background: #174f91; }.kb-label-purple { background: #7954a2; }.kb-label-green { background: #317962; }.kb-label-orange { background: #925712; }.kb-label-red { background: #a9424b; }.kb-label-slate { background: #566981; }
.kb-card-meta { display: flex; flex-wrap: wrap; gap: .65rem; }
.kb-card-excerpt { white-space: pre-wrap; }
.kb-card-order { display: flex; justify-content: flex-end; padding: 0 .3rem .3rem; gap: .15rem; }
.kb-drop-hint { text-align: center; padding: 1rem .2rem; }
.kb-add-card > summary { display: flex; gap: .4rem; align-items: center; cursor: pointer; padding: .5rem .25rem; color: var(--muted); list-style: none; }
.kb-add-card > summary::-webkit-details-marker { display: none; }
.kb-add-card > summary:hover { background: var(--accent-soft); border-radius: 5px; }
.kb-new-list { background: color-mix(in srgb, var(--kb-color) 8%, var(--surface)); }
.kb-new-list h2 { margin: .3rem 0 .75rem; }
.kb-settings, .kb-card-detail { max-width: 800px; margin: 1.5rem auto; }
.kb-board-form-actions { margin-top: 1rem; }
.kb-board-delete { margin: 0 0 0 .5rem; }
.kb-card-form-actions { margin-top: 1rem; }
.kb-card-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.kb-card-fields select { width: 100%; }
.kb-checklist { border: 1px solid var(--line); border-radius: 8px; padding: .75rem; min-width: 0; }
.kb-task { display: flex; gap: .5rem; align-items: center; margin: .5rem 0; }
.kb-task > input { min-width: 0; }
.kb-task > label { flex-shrink: 0; }
.kb-card-dialog { width: min(780px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--surface); color: var(--text); box-shadow: var(--dialog-shadow); }
.kb-card-dialog:not([open]) { display: none; }
.kb-card-dialog::backdrop { background: rgb(8 25 48 / 45%); backdrop-filter: blur(3px); }
.kb-dialog-close { float: right; position: sticky; top: 0; z-index: 2; background: var(--surface); }
.kb-card-dialog .kb-card-detail { margin: 0; border: 0; box-shadow: none; padding: .5rem; }
.kb-drop-active { outline: 2px dashed var(--accent); outline-offset: 2px; }
.kb-drop-before { border-top: 4px solid var(--accent); }.kb-drop-after { border-bottom: 4px solid var(--accent); }
@media (max-width: 600px) { .kb-workspace, .kb-directory { padding: .75rem; } .kb-list { flex-basis: min(285px, 85vw); } .kb-card-fields { grid-template-columns: 1fr; } .kb-task { flex-wrap: wrap; } .kb-task > input { flex: 1; } }

/* Shared action grouping: separate forms keep independent submit/validation. */
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.action-row > form { display: inline-flex; align-items: center; gap: .5rem; margin: 0; }
.action-row > span:has(> .icon-button) { display: inline-flex; align-items: center; }
.action-row > .icon-danger:not(:first-child),
.action-row > form:has(> .icon-danger):not(:first-child) { margin-inline-start: .5rem; }

.kb-task-list { padding: .4rem .8rem; }
.kb-task-list:empty { display: none; }
.kb-task-progress { display: flex; align-items: center; gap: .75rem; margin-bottom: .4rem; }
.kb-task-progress progress { flex: 1; min-width: 0; width: 100%; height: 7px; accent-color: var(--accent); }
.kb-task-progress > span { flex-shrink: 0; }
.kb-task-list ul { margin: 0; }
.kb-task-check { padding: .4rem 0; cursor: pointer; align-items: flex-start !important; }
.kb-task-check input { flex-shrink: 0; margin-top: .25rem; }
.kb-task-check span { overflow-wrap: anywhere; min-width: 0; }
.kb-task-check input:checked + span { text-decoration: line-through; color: var(--muted); }
.kb-card .kb-task-check { font-size: .8rem; }
.kb-edit-tasks > summary { cursor: pointer; color: var(--accent); padding: .4rem 0; }
.kb-edit-tasks .kb-checklist { margin-top: .5rem; }

/* Task rows mirror a task manager: checkbox, editable name, subtle actions. */
.kb-task-row { display: flex; align-items: center; gap: .4rem; min-height: 44px; }
.kb-task-row > form { margin: 0; }
.kb-task-row > form:first-child { flex: 0 0 auto; }
.kb-card .kb-task-row > form:first-child { flex: 1; }
.kb-task-rename { display: flex; flex: 1; min-width: 0; align-items: center; gap: .25rem; }
.kb-task-rename input { background: transparent; border-color: transparent; padding: .35rem .25rem; font-weight: 400; }
.kb-task-rename input:focus { background: var(--bg); border-color: var(--accent); }
.kb-task-done [data-kb-task-title] { text-decoration: line-through; color: var(--muted); }
.kb-task-rename .icon-button, .kb-task-remove .icon-button { opacity: 0; }
.kb-task-rename:focus-within .icon-button, .kb-task-row:hover .kb-task-remove .icon-button, .kb-task-row:focus-within .kb-task-remove .icon-button { opacity: 1; }
.kb-add-task { display: flex; gap: .5rem; align-items: center; margin-top: .6rem; }
.kb-add-task input { min-width: 0; min-height: 42px; border-color: var(--line); background: var(--bg); }
.kb-add-task input:focus { border-color: var(--accent); background: var(--bg); }
@media (hover: none) { .kb-task-rename .icon-button, .kb-task-remove .icon-button { opacity: 1; } }

.kb-task-list-editable { padding: .75rem 0 1rem; }
.kb-task-list-heading { font: 650 1rem var(--sans); margin: 0 0 .5rem; }
.kb-task-list-heading::before { content: none; }
.kb-add-task-hint { margin: .4rem 0 0; }

.kb-card-detail .kb-task-row { display: grid; grid-template-columns: 1rem minmax(0, 1fr) 140px 130px 36px; gap: .5rem; }
.kb-task-due-form input { width: 140px; min-width: 0; padding: .25rem; font-size: .8rem; background: transparent; border-color: var(--line); }
.kb-add-task [data-kb-add-task-input] { flex: 1; }
.kb-add-task [data-kb-new-task-due] { flex: 0 1 150px; width: 150px; font-size: .8rem; }
.kb-task-due { font-size: .65rem; color: var(--muted); white-space: nowrap; }
.kb-task-overdue { color: var(--danger); }
@media (max-width: 600px) {
  .kb-card-detail .kb-task-row { grid-template-columns: 1rem minmax(0, 1fr) 36px; }
  .kb-task-owner-form { grid-column: 2; grid-row: 2; }
  .kb-task-due-form { grid-column: 2; grid-row: 3; }
  .kb-task-remove { grid-column: 3; grid-row: 1; }
  .kb-add-task { flex-wrap: wrap; }
  .kb-add-task [data-kb-add-task-input] { flex-basis: calc(100% - 50px); }
}

/* Notification preferences and delivery history */
.notification-preferences-table { overflow-x: auto; margin-block: 1rem; }
.notification-preferences-table table { width: 100%; border-collapse: collapse; }
.notification-preferences-table th, .notification-preferences-table td { text-align: left; padding: .65rem; border-bottom: 1px solid var(--line, #cad7e7); }
.notification-preferences-table input[type=checkbox] { width: 1.1rem; height: 1.1rem; margin: 0; }
.notification-field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.notification-field-row > label { flex: 1 1 12rem; }
.notification-body { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.notification-devices { border-top: 1px solid var(--line, #cad7e7); padding-top: 1rem; margin-top: 1.5rem; }
.notes > li { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.notes > li > div { min-width: 0; overflow-wrap: anywhere; }
.notification-settings .check { display: flex; align-items: flex-start; gap: .5rem; }
.notification-settings .check input { flex: 0 0 auto; width: auto; margin-top: .25rem; }
[data-notification-badge][hidden] { display: none; }
@media (max-width: 600px) {
  .notification-preferences-table th, .notification-preferences-table td { padding: .5rem .3rem; }
  .notification-preferences-table select { min-width: 7rem; }
}

/* Shared chrome applies to every workspace, form and dialog. */
.logo { font-size: 1.25rem; letter-spacing: -.025em; }
.logo-mark { width: 2rem; height: 2rem; }
h1 { font-size: clamp(1.45rem, 2vw, 1.75rem); font-weight: 650; letter-spacing: -.03em; }
h2 { font-weight: 600; }
.panel-title, .listing th { text-transform: none; letter-spacing: 0; font-weight: 600; }
.panel-title { border-bottom: 0; }
.nav { gap: var(--space-1); }
.nav a { border-radius: var(--pill-radius); padding: .45rem .75rem; }
.nav a:hover { background: var(--masthead-hover); color: var(--masthead-text); }
.nav a.active, .nav a.active:hover { background: var(--masthead-gold); color: var(--masthead); }
:is(input, textarea, select) { border-radius: var(--control-radius); }
select {
  max-width: 100%; min-height: var(--control-size); padding: .4rem .6rem;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit;
}
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=hidden]), select { min-height: var(--control-size); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .button { border-radius: var(--control-radius); }
button:hover, .button:hover { filter: none; }
button:disabled { cursor: not-allowed; }
.icon-button svg { width: var(--icon-size); height: var(--icon-size); }
.icon-button:hover { color: var(--text); background: var(--control-hover); }
.icon-button:focus-visible, .icon-active, .chip-on { color: var(--accent); background: var(--accent-soft); }
.icon-danger, .icon-danger:hover, .icon-danger:focus-visible { color: var(--danger); }
.icon-danger:hover, .icon-danger:focus-visible { background: var(--danger-soft); }
.action-row { gap: var(--space-2); }
fieldset, .error, .notice, .cal-repeat, .cal-layout, .cal-location-results, .kb-checklist, .group-card { border-radius: var(--radius); }
.tabs {
  width: fit-content;
  max-width: 100%;
  flex-wrap: nowrap;
  gap: var(--space-1);
  padding: var(--space-1);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  background: var(--control-hover);
}
.tabs a { flex: 0 0 auto; padding: .4rem .9rem; white-space: nowrap; border-color: transparent; border-radius: var(--pill-radius); color: var(--muted); }
.tabs a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.tabs a.active { background: var(--surface-raised); color: var(--accent); border-color: transparent; font-weight: 600; box-shadow: var(--shadow); }
.listing th { border-bottom-width: 1px; }
.listing .num { font-variant-numeric: tabular-nums; }
.cal-view-tabs { background: var(--control-hover); border: 0; }
.cal-sidebar, .kb-list { background: var(--bg); }
.kb-card { border-radius: var(--radius); box-shadow: var(--shadow); }
.kb-card-link:hover { border-radius: var(--radius) var(--radius) 0 0; }
.kb-workspace { background: var(--bg); }
.kb-new-list { background: var(--surface); }
.cal-scope-dialog, .kb-card-dialog { border-radius: var(--dialog-radius); background: var(--surface-raised); box-shadow: var(--dialog-shadow); }
@media (max-width: 600px) {
  .top { padding: .65rem .75rem; gap: .5rem; }
  .nav { width: 100%; }
  .nav a { padding: .35rem .5rem; }
}
@media (pointer: coarse) {
  :root { --control-size: 2.75rem; }
}

/* Calendar-inspired shared surfaces: soft containers, quiet rows and clear groups. */
.main, .side { min-width: 0; }
.card, .panel { box-shadow: none; }
.card > :last-child, .panel > :last-child { margin-bottom: 0; }
.page-heading { margin-bottom: var(--space-4); line-height: 1.25; }
.page-heading > a { padding: var(--space-2); border-radius: var(--control-radius); text-decoration: none; }
.panel-title { margin-bottom: var(--space-3); font-size: .8rem; }
.side .plain a { display: block; padding: .4rem .6rem; border-radius: var(--control-radius); }
.side .plain a:hover, .side .plain a:focus-visible { background: var(--accent-soft); text-decoration: none; }
.side .online a { display: inline-block; }
:is(.composer, .admin-section) > summary { padding: var(--space-2); border-radius: var(--control-radius); }
.admin-section[open] > summary { margin-bottom: var(--space-4); }
.stack { gap: var(--space-4); }
fieldset { padding: var(--space-4); }
legend { padding-inline: var(--space-2); font-weight: 600; }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]):not([type=hidden]), textarea { padding: .6rem .75rem; }
:is(.avatar, .post-image, .chat-log, .dm, .group-manager-card, .kb-checklist) { border-radius: var(--radius); }
.tag { border-radius: var(--pill-radius); padding: .1rem .5rem; background: var(--control-hover); border-color: transparent; }
.listing th { padding: var(--space-2) var(--space-3); background: var(--control-hover); }
.listing td { padding: var(--space-3); }
.listing tbody tr:last-child > td { border-bottom: 0; }
:is(.people li, .group-user-card, .file-row, [data-comments-body], [data-edit-message]) { border-radius: var(--control-radius); }
@media (max-width: 600px) {
  .frame { margin-block: var(--space-3); padding-inline: var(--space-3); }
  .frame.frame-calendar { margin: 0; padding: 0; }
  .card { padding: var(--space-4); }
  .frame-calendar .calendar-shell { padding: 0; }
  .tabs a { padding-inline: .75rem; }
}

/* Calendar desktop workspace: sidebar, centered view switcher and broad month grid. */
.frame-calendar .calendar-shell { padding: 0; }
.cal-app-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(150px, 1fr); align-items: center; gap: 1rem; padding: .65rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.cal-app-title { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.cal-app-title .page-heading { margin: 0; font-size: 1rem; }
.cal-app-toolbar .cal-view-tabs { margin: 0; }
.cal-toolbar-zone { text-align: right; }
.frame-calendar .cal-layout { grid-template-columns: 225px minmax(0, 1fr); border: 0; border-radius: 0; overflow: visible; }
.cal-sidebar { display: flex; flex-direction: column; gap: 2rem; padding: 1rem .75rem; }
.cal-sidebar-info h3 { margin: .25rem .5rem 1rem; color: var(--muted); font-size: .75rem; }
.cal-sidebar-info p { margin: .75rem .5rem; }
.cal-calendar-source { display: flex; align-items: center; gap: .6rem; border-radius: var(--control-radius); background: var(--accent-soft); color: var(--text); padding: .65rem .6rem; font-size: .9rem; font-weight: 600; }
.cal-source-mark { width: .7rem; height: .7rem; border-radius: 3px; background: var(--accent); flex-shrink: 0; }
.cal-mini-section { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }
.cal-mini-header { display: flex; align-items: center; justify-content: space-between; gap: .15rem; margin-bottom: .6rem; }
.cal-mini-header .cal-mini-title { margin: 0; font-size: .75rem; }
.cal-mini-header .icon-button { width: 1.75rem; height: 1.75rem; }
.cal-mini { gap: .3rem; }
.cal-content > .cal-toolbar { padding: 1.25rem 1.25rem .7rem; margin: 0; gap: .75rem; }
.cal-period h2 { font-size: clamp(1.6rem, 2.8vw, 2.5rem); letter-spacing: -.035em; font-weight: 400; line-height: 1.2; }
.cal-period h2 strong { font-weight: 650; }
.cal-period h2 > span { font-weight: 350; color: var(--muted); }
.cal-period-actions { margin-left: auto; gap: .2rem; }
.cal-period-actions .icon-button { border-radius: 999px; background: var(--control-hover); }
.cal-period-actions .icon-button:hover { background: var(--accent-soft); color: var(--accent); }
.cal-weekday { font-size: .8rem; text-transform: none; padding: .7rem .75rem; color: var(--text); }
.cal-weekend { background: color-mix(in srgb, var(--bg) 65%, var(--surface)); }
.cal-weekday.cal-weekend { color: var(--muted); }
.frame-calendar .cal-month { grid-template-rows: auto repeat(6, minmax(105px, 1fr)); }
.cal-day { padding: .35rem; }
.cal-day-number { font-size: .9rem; margin-bottom: .25rem; }
.cal-day-selected { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.cal-day.cal-outside { opacity: 1; }
.cal-day.cal-outside .cal-day-number { color: var(--muted); opacity: .6; }
.cal-event { display: flex; align-items: baseline; gap: .35rem; padding: 2px 5px; border-left-width: 3px; font-size: .75rem; }
.cal-event-title { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; }
.cal-event .cal-time { flex: 0 0 auto; color: var(--text); font-size: .85em; font-weight: 400; margin-left: auto; }
.cal-event-timed, .cal-event-all-day {
  border-radius: 8px;
  background: color-mix(in srgb, var(--event-color) 32%, var(--surface));
}
.cal-month .cal-event-timed { border-radius: 999px; padding-inline: .5rem; }
.cal-event-all-day { border: 0; border-radius: 999px; }
.cal-event:hover { filter: none; background: color-mix(in srgb, var(--event-color) 38%, var(--surface)); text-decoration: none; }
.cal-event:focus-visible { outline-offset: -1px; }
.cal-agenda .cal-event-title, .cal-timed-slot .cal-event-title { white-space: normal; overflow: visible; }
.cal-timed-slot .cal-event { flex-wrap: wrap; align-content: flex-start; }
@media (max-width: 1000px) {
  .frame-calendar .cal-layout { grid-template-columns: minmax(0, 1fr); }
  .cal-sidebar { display: none; }
  .cal-app-toolbar { grid-template-columns: auto 1fr; }
  .cal-app-toolbar .cal-view-tabs { justify-self: end; }
  .cal-toolbar-zone { display: none; }
}
@media (max-width: 600px) {
  .cal-app-toolbar { display: flex; flex-wrap: wrap; padding: .65rem; gap: .6rem; }
  .cal-app-title { flex: 1; justify-content: space-between; }
  .cal-app-toolbar .cal-view-tabs { width: 100%; justify-content: center; }
  .cal-content > .cal-toolbar { padding: .8rem .5rem; }
  .cal-period h2 { font-size: 1.5rem; }
  .cal-weekday { padding: .5rem .25rem; font-size: .7rem; }
  .frame-calendar .cal-month { grid-template-rows: auto repeat(6, minmax(88px, 1fr)); }
  .cal-day { padding: 2px; min-height: 88px; }
  .cal-month .cal-event { font-size: .65rem; gap: .1rem; padding: 2px 3px; }
}
@media (pointer: coarse) {
  .cal-mini-header .icon-button { width: var(--control-size); height: var(--control-size); }
}

/* Day view: full-height event blocks and a persistent, selectable inspector. */
.cal-day-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 310px; flex: 1; min-height: 0; }
.cal-day-main { min-width: 0; }
.cal-day-weekday { margin: 0; padding: 0 1.25rem .8rem; font-size: 1.25rem; font-weight: 400; border-bottom: 1px solid var(--line); }
.cal-day-all-day { display: grid; grid-template-columns: 68px minmax(0, 1fr); padding: .5rem .5rem .5rem 1rem; gap: .5rem; min-height: 44px; border-bottom: 1px solid var(--line); }
.cal-day-scroll { position: relative; height: min(900px, calc(100dvh - 290px)); min-height: 360px; overflow-y: auto; }
.cal-day-hours { height: 1728px; }
.cal-day-hour { height: 72px; padding-left: .5rem; color: var(--muted); font-size: .75rem; }
.cal-day-hour::after { content: ''; display: block; border-top: 1px solid var(--line); margin-left: 60px; }
.cal-day-hour > span { position: absolute; width: 52px; text-align: right; transform: translateY(-.1em); }
.cal-day-events { position: absolute; top: 0; left: 68px; right: 8px; height: 1728px; }
.cal-day-event-slot { position: absolute; padding: 2px; min-width: 0; }
.cal-day-event-slot .cal-event { height: 100%; margin: 0; padding: .5rem; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: .25rem; border-radius: var(--radius); overflow: hidden; white-space: normal; background: color-mix(in srgb, var(--event-color) 45%, var(--surface)); }
.cal-day-event-slot .cal-event-title { flex: 0 0 auto; max-width: 100%; font-size: .9rem; font-weight: 600; }
.cal-day-event-slot .cal-time { margin: 0; }
.cal-day-event-selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-day-inspector { min-width: 0; padding: 1rem; background: var(--bg); border-left: 1px solid var(--line); max-height: calc(100dvh - 210px); overflow-y: auto; }
.cal-day-event-detail { border-left: 4px solid var(--event-color); padding-left: .65rem; }
.cal-day-event-detail[hidden] { display: none; }
.cal-day-detail-card { padding: .85rem; margin-bottom: .65rem; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius); overflow-wrap: anywhere; }
.cal-day-detail-card h3 { margin: 0; font-size: 1.2rem; font-weight: 650; }
.cal-day-detail-card h4 { margin: 0 0 .5rem; font-size: .8rem; color: var(--muted); }
.cal-day-detail-card p:last-child { margin-bottom: 0; }
@media (max-width: 1200px) { .cal-day-workspace { grid-template-columns: minmax(0, 1fr) 260px; } }
@media (max-width: 700px) {
  .cal-day-workspace { grid-template-columns: minmax(0, 1fr); }
  .cal-day-inspector { max-height: none; border-left: 0; border-top: 1px solid var(--line); }
  .cal-day-scroll { height: 480px; }
}

/* Week view shares day-view time geometry, with seven aligned day columns. */
.cal-week-scroll { height: min(1000px, calc(100dvh - 235px)); min-height: 420px; overflow: auto; border-top: 1px solid var(--line); }
.cal-week-canvas { min-width: 780px; }
.cal-week-header, .cal-week-body { display: grid; grid-template-columns: 68px repeat(7, minmax(0, 1fr)); }
.cal-week-header { position: sticky; top: 0; z-index: 3; background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.cal-week-heading { padding: .75rem .3rem; text-align: center; color: var(--text); font-size: 1.05rem; border-bottom: 1px solid var(--line); }
.cal-week-heading strong { font-weight: 500; }
.cal-week-heading:hover { background: var(--accent-soft); text-decoration: none; }
.cal-week-heading.cal-today-heading { color: var(--accent); background: var(--accent-soft); }
.cal-week-all-day, .cal-week-column { border-left: 1px solid var(--line); min-width: 0; }
.cal-week-all-day { padding: 3px; min-height: 38px; }
.cal-week-all-day-label { padding: .5rem; }
.cal-week-gutter { border-bottom: 1px solid var(--line); }
.cal-week-body { height: 1728px; }
.cal-week-column { position: relative; height: 1728px; background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent 72px); }
.cal-week-body .cal-day-hour::after { display: none; }
.cal-week-body .cal-day-hour { padding-top: .15rem; }
.cal-week-event-slot { position: absolute; padding: 2px 3px; min-width: 0; }
.cal-week-event-slot .cal-event { height: 100%; margin: 0; padding: .4rem; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: .2rem; border-radius: var(--radius); background: color-mix(in srgb, var(--event-color) 38%, var(--surface)); white-space: normal; overflow: hidden; }
.cal-week-event-slot .cal-event-title { flex: 0 0 auto; max-width: 100%; font-size: .8rem; font-weight: 600; }
.cal-week-event-slot .cal-time { margin: 0; font-size: .7rem; }
.cal-week-event-slot .cal-event:hover { background: color-mix(in srgb, var(--event-color) 45%, var(--surface)); }
@media (max-width: 600px) {
  .cal-week-scroll { height: 600px; }
  .cal-week-heading { font-size: .85rem; }
}

/* Rounded segmented view selector, shared by every calendar view. */
.cal-app-toolbar .cal-view-tabs { padding: 4px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--control-hover); box-shadow: inset 0 1px 1px rgb(255 255 255 / 6%); }
.cal-app-toolbar .cal-view-tabs a { padding: .4rem 1rem; border-radius: 999px; font-weight: 500; color: var(--text); white-space: nowrap; }
.cal-app-toolbar .cal-view-tabs a:hover { background: var(--surface); }
.cal-app-toolbar .cal-view-tabs a.active { color: var(--accent); background: var(--surface-raised); box-shadow: var(--shadow); font-weight: 650; }
.cal-year { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2rem 2.5rem; padding: 1.5rem 2rem 2rem; }
.cal-year-month { min-width: 0; }
.cal-year-month h3 { margin: 0 0 1rem; font-size: 1.2rem; font-weight: 500; }
.cal-year-month h3 a { color: var(--gold); }
.cal-year-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .25rem; text-align: center; font-size: .8rem; font-variant-numeric: tabular-nums; }
.cal-year-grid > a, .cal-year-weekday { display: grid; place-items: center; min-height: 28px; border-radius: 999px; }
.cal-year-grid > a { color: var(--text); }
.cal-year-grid > a:hover { background: var(--accent-soft); text-decoration: none; }
.cal-year-grid > a.cal-today { background: var(--accent); color: var(--accent-text); }
.cal-year-weekday { color: var(--muted); font-size: .7rem; margin-bottom: .4rem; }
@media (max-width: 1300px) { .cal-year { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.75rem; padding: 1.5rem; } }
@media (max-width: 800px) { .cal-year { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; } }
@media (max-width: 600px) { .cal-app-toolbar .cal-view-tabs a { padding: .4rem .6rem; } .cal-year { padding: 1rem .65rem; gap: 1.5rem .75rem; } .cal-year-grid { gap: 1px; font-size: .75rem; } }
@media (max-width: 360px) { .cal-year { grid-template-columns: minmax(0, 1fr); } }
@media (pointer: coarse) { .cal-year-grid > a { min-height: 36px; } }

.cal-category-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: 1rem; }
.cal-category-heading h4 { margin: 0; font-size: .8rem; color: var(--muted); font-weight: 600; }
.cal-category-list li { display: flex; align-items: center; gap: .5rem; overflow-wrap: anywhere; padding: .5rem .25rem; font-size: .85rem; }
.cal-category-list .cal-color-swatch { flex: 0 0 auto; width: .75rem; height: .75rem; border-radius: 3px; }
.cal-category-card { margin: 1rem 0; border: 1px solid var(--line); padding: .75rem; border-radius: var(--radius); }
.cal-category-card > summary { display: flex; gap: .5rem; align-items: center; cursor: pointer; }
.cal-category-card > form { margin-top: 1rem; }

.cal-category-list label.check { width: 100%; padding: .35rem .4rem; margin: 0; border-radius: var(--control-radius); cursor: pointer; align-items: center; font-size: .85rem; }
.cal-category-list label.check:hover { background: var(--control-hover); }
.cal-category-list label.check:has(input:checked) { background: var(--accent-soft); }
.cal-category-list input[type=checkbox] { flex: 0 0 auto; width: 1rem; height: 1rem; margin: 0; }
.cal-category-list li { padding: .1rem 0; }
.cal-category-filter-enhanced > .action-row { display: none; }
.cal-mobile-category-filter { display: none; border-bottom: 1px solid var(--line); padding: .5rem .75rem; }
.cal-mobile-category-filter > summary { cursor: pointer; color: var(--accent); font-size: .85rem; }
@media (max-width: 1000px) { .cal-mobile-category-filter { display: block; } }

/* Deadlines are source-linked all-day items, distinct in shape as well as color. */
.cal-event.cal-deadline { border: 1px dashed var(--event-color); border-left: 4px solid var(--event-color); border-radius: 5px; background: color-mix(in srgb, var(--event-color) 18%, var(--surface)); align-items: center; }
.cal-deadline-icon { display: inline-flex; flex: 0 0 auto; color: var(--text); }
.cal-deadline-icon svg { width: .85rem; height: .85rem; }
.cal-deadline-done .cal-event-title { text-decoration: line-through; color: var(--muted); }
.cal-event.cal-deadline:hover { background: color-mix(in srgb, var(--event-color) 28%, var(--surface)); }
.cal-year-grid > a.cal-year-has-deadline { border-bottom: 2px dashed var(--gold); }

/* Post reactions use emoji chips and a native, keyboard-accessible picker. */
.reaction-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; min-width: 0; }
.reaction-bar > form, .reaction-options > form { display: inline-flex; margin: 0; }
.reaction-chip, .reaction-picker > summary { display: inline-flex; gap: .35rem; align-items: center; min-height: 32px; padding: .2rem .55rem; font: 500 .8rem var(--sans); }
.reaction-emoji { font-size: 1rem; line-height: 1; }
.reaction-chip.chip-on { border-color: var(--accent); background: var(--accent-soft); }
.reaction-picker { position: relative; }
.reaction-picker > summary { cursor: pointer; list-style: none; }
.reaction-picker > summary::-webkit-details-marker { display: none; }
.reaction-picker > summary svg { width: 1rem; height: 1rem; }
.reaction-picker > summary:hover, .reaction-chip:hover { background: var(--control-hover); }
.reaction-options { position: absolute; z-index: 20; left: 0; bottom: calc(100% + .5rem); display: grid; grid-template-columns: repeat(6, 42px); gap: .25rem; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-raised); box-shadow: var(--dialog-shadow); }
.reaction-option { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; padding: 0; font-size: 1.25rem; border: 0; background: transparent; color: var(--text); border-radius: var(--control-radius); }
.reaction-option:hover { background: var(--control-hover); }
.reaction-option.chip-on { background: var(--accent-soft); }
.reaction-bar button:disabled { opacity: .5; cursor: wait; }
@media (pointer: coarse) { .reaction-chip, .reaction-picker > summary { min-height: 44px; } .reaction-option { height: 44px; } }
@media (max-width: 600px) { .reaction-options { grid-template-columns: repeat(4, 42px); } }
.reaction-picker:not([open]) .reaction-options { display: none; }
@media (max-width: 600px) {
  .reaction-options { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); max-width: calc(100vw - 1rem); }
}

/* Files section: one shared list of documents, using the common tokens. */
.file-filter { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-3); }
.file-filter > label:first-child { flex: 1 1 14rem; }
.file-filter label.check { margin-bottom: .45rem; }
.file-list { padding-block: var(--space-1); }
.file-row { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) 0; }
.file-row + .file-row { border-top: 1px solid var(--line); }
.file-kind { flex: 0 0 3rem; padding: .3rem 0; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--accent-soft); color: var(--accent); font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-align: center; text-transform: uppercase; }
.file-main { flex: 1 1 auto; min-width: 0; }
.file-name { font-weight: 600; overflow-wrap: anywhere; }
.file-row .action-row { flex: 0 0 auto; flex-wrap: nowrap; }
.file-facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-3); margin: 0; }
.file-facts dt { color: var(--muted); }
.file-facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) {
  .file-row { flex-wrap: wrap; }
  .file-row .action-row { margin-left: calc(3rem + var(--space-3)); }
}

/* Configurable header navigation and its administrative editor. */
.top { position: relative; z-index: 50; }
.nav-dropdown { position: relative; }
.nav-dropdown > summary { display: flex; align-items: center; gap: .3rem; padding: .45rem .75rem; border-radius: var(--pill-radius); color: var(--masthead-text); cursor: pointer; list-style: none; }
.nav-dropdown > summary::-webkit-details-marker { display: none; }
.nav-dropdown > summary:hover { background: var(--masthead-hover); }
.nav-dropdown > summary.active { background: var(--masthead-gold); color: var(--masthead); font-weight: 600; }
.nav-chevron { font-size: .8rem; }
.nav-dropdown-panel { position: absolute; z-index: 40; left: 0; top: calc(100% + .4rem); min-width: 190px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 120px); overflow-y: auto; padding: .35rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--masthead); box-shadow: var(--dialog-shadow); }
.nav-dropdown:not([open]) > .nav-dropdown-panel { display: none; }
.nav-dropdown-panel > a { display: block; margin: .1rem 0; overflow-wrap: anywhere; }
.nav-dropdown-panel .badge[hidden], .nav [data-nav-group-badge][hidden] { display: none; }
.nav-editor-list { list-style: none; margin: .5rem 0; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius); min-height: 48px; }
.nav-editor-root { border: 0; padding: 0; }
.nav-editor-node { padding: .6rem; margin: .5rem 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.nav-editor-group { background: var(--bg); }
.nav-editor-row { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.nav-editor-grip { cursor: grab; color: var(--muted); padding: .4rem .1rem; }
.nav-editor-label { flex: 1 1 150px; min-width: 0; }
.nav-editor-parent { flex: 1 1 130px; min-width: 0; }
.nav-editor-group > .nav-editor-list { margin-left: 1.2rem; }
.nav-dragging { opacity: .5; }
@media (max-width: 600px) { .nav-editor-node { padding: .5rem; } .nav-editor-group > .nav-editor-list { margin-left: .25rem; } .nav-dropdown > summary { padding: .35rem .5rem; } }

/* Drag hints show the same insertion position used when dropping. */
.nav-editor-node, .nav-editor-list { position: relative; }
.nav-drop-before::before, .nav-drop-after::after, .nav-drop-inside::after {
  content: ''; position: absolute; left: 0; right: 0; height: 3px;
  border-radius: 999px; background: var(--accent); pointer-events: none; z-index: 2;
}
.nav-drop-before::before { top: -.35rem; }
.nav-drop-after::after { bottom: -.35rem; }
.nav-drop-inside { background: var(--accent-soft); outline: 1px dashed var(--accent); outline-offset: -1px; }
.nav-drop-inside::after { bottom: 2px; left: .5rem; right: .5rem; }
/* Native popovers render in the browser's top layer and dismiss on outside click. */
.nav-dropdown-panel[popover] { position: fixed; inset: auto; margin: 0; color: var(--masthead-text); }
.nav-dropdown-panel[popover]:not(:popover-open) { display: none; }

/* Degree Planner: rosters, assignments and the shared structure editor. */
.degree-heading { align-items: center; }
.degree-filter { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-3); }
.degree-filter > label { flex: 1 1 12rem; }
.degree-list { padding-block: var(--space-1); }
.degree-list > .degree-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); }
.degree-row + .degree-row { border-top: 1px solid var(--line); }
.degree-row-main { flex: 1 1 auto; min-width: 0; }
.degree-row-title { font-weight: 600; overflow-wrap: anywhere; }
.degree-count { flex: 0 0 auto; padding: .15rem .5rem; border: 1px solid var(--line); border-radius: var(--control-radius); color: var(--muted); font-size: .8rem; white-space: nowrap; }
.degree-count-full { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.degree-schedule { flex-wrap: wrap; align-items: end; gap: var(--space-3); }
.degree-schedule > label { flex: 1 1 9rem; }
.degree-notes { white-space: pre-wrap; }
.degree-group + .degree-group { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.degree-group h3, .degree-edit-group h3 { margin: 0 0 var(--space-2); }
.degree-slot { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(10rem, 1.2fr) minmax(8rem, 1fr); align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-1) 0; }
.degree-slot > label { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.degree-notices { margin-bottom: var(--space-3); }
.degree-notice { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.degree-edit-group { margin-bottom: var(--space-3); padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.degree-edit-row { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) 0; }
.degree-edit-section input[name='name'] { font-weight: 700; }
.degree-edit-fields, .degree-add { display: flex; flex: 1 1 auto; align-items: center; gap: var(--space-2); min-width: 0; }
.degree-edit-fields > input, .degree-add > input:not([type='hidden']) { flex: 1 1 8rem; min-width: 0; }
.degree-edit-fields > select { flex: 0 1 10rem; min-width: 0; }
.degree-edit-row .action-row { flex: 0 0 auto; flex-wrap: nowrap; }
.degree-add { margin-top: var(--space-2); }
@media (max-width: 620px) {
  .degree-slot { grid-template-columns: 1fr; gap: var(--space-1); padding: var(--space-2) 0; }
  .degree-edit-row { flex-wrap: wrap; }
  .degree-edit-fields { flex-wrap: wrap; }
  .degree-edit-fields > input { flex-basis: 100%; }
  .degree-edit-fields > select { flex: 1 1 8rem; }
  .degree-row { flex-wrap: wrap; }
}

/* Roster structure: quiet lanes, grip handles and precise insertion markers. */
.degree-lanes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.degree-lane { min-width: 0; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--control-radius); }
.degree-lane h3 { margin: 0 0 var(--space-2); font-size: .9rem; color: var(--muted); }
.degree-edit-group { margin: var(--space-3) 0 0; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--control-radius); }
.degree-grip { cursor: grab; color: var(--muted); touch-action: none; }
.degree-grip:active { cursor: grabbing; }
.degree-grip[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent); }
.degree-edit-row { position: relative; }
.degree-lane .degree-edit-row { flex-wrap: wrap; gap: var(--space-1); }
.degree-lane .degree-edit-fields { flex: 1 1 8rem; }
.degree-lane .degree-edit-fields > input:not([type='hidden']) { width: 0; }
.degree-place { display: none; border: 1px dashed var(--line); background: transparent; color: var(--accent); border-radius: var(--control-radius); padding: var(--space-2); cursor: pointer; width: 100%; text-align: left; }
:is([data-moving='role'] [data-degree-place][data-kind='role'], [data-moving='lecture'] [data-degree-place][data-kind='lecture'], [data-moving='section'] [data-degree-place][data-kind='section']) { display: block; }
.degree-place:hover, .degree-place:focus-visible { background: var(--accent-soft); }
.degree-place-before { flex: 1 0 100%; font-size: .75rem; }
.degree-drop-before { box-shadow: 0 -3px 0 var(--accent); }
.degree-drop-after { box-shadow: 0 3px 0 var(--accent); }
.degree-drop-active { outline: 2px solid var(--accent); background: var(--accent-soft); }
@media (max-width: 800px) { .degree-lanes { grid-template-columns: 1fr; } }

.degree-pointer-drag .degree-place { display: none !important; }
.degree-drag-preview { position: fixed; pointer-events: none; z-index: 10000; padding: .5rem .75rem; border: 1px solid var(--accent); border-radius: var(--control-radius); background: var(--surface); color: var(--accent); box-shadow: 0 6px 24px #0003; font-size: .875rem; }
body.degree-dragging { user-select: none; cursor: grabbing; }

/* The roster uses the template editor, with assignments below each item. */
.degree-row-assignment { flex: 1 0 100%; padding: var(--space-2); background: var(--accent-soft); border-radius: var(--control-radius); }
.degree-row-assignment .degree-slot { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); padding: 0; }
.degree-row-assignment .degree-slot > label { font-size: .8rem; color: var(--muted); }
.degree-row-assignment .degree-slot > select, .degree-row-assignment .degree-slot > input { width: 100%; min-width: 0; }

/* Saved roster overview: a responsive tree with connected section branches. */
.degree-flow { padding: var(--space-3) 0; }
.degree-flow-root { position: relative; max-width: 34rem; margin: 0 auto 2rem; padding: 1.25rem; text-align: center; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--control-radius); }
.degree-flow-root h2 { margin: .25rem 0 .5rem; overflow-wrap: anywhere; }
.degree-flow-root p { margin: .25rem 0; }
.degree-flow-root::after { content: ''; position: absolute; height: 2rem; width: 2px; background: var(--line); left: 50%; top: 100%; }
.degree-flow-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1.5rem; padding-top: 1.5rem; border-top: 2px solid var(--line); }
.degree-flow-branch { position: relative; min-width: 0; }
.degree-flow-branch::before { content: ''; position: absolute; width: 2px; height: 1.5rem; background: var(--line); left: 50%; bottom: 100%; }
.degree-flow-branch > h3 { margin: 0; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--accent-soft); color: var(--accent); font-size: 1rem; overflow-wrap: anywhere; }
.degree-flow-items.plain { margin: 0 0 0 1rem; padding: .75rem 0 0 1rem; border-left: 2px solid var(--line); }
.degree-flow-items.plain > .degree-flow-node { position: relative; margin-bottom: .75rem; padding: .875rem 1rem; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface); overflow-wrap: anywhere; }
.degree-flow-node::before { content: ''; position: absolute; left: calc(-1rem - 2px); top: 1.5rem; height: 2px; width: 1rem; background: var(--line); }
.degree-flow-kind { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; }
.degree-flow-node h4 { margin: .25rem 0 .5rem; font-size: .95rem; }
.degree-flow-node p { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: .875rem; }
.degree-flow-node p svg { flex-shrink: 0; color: var(--accent); }
.degree-flow-items.plain > .degree-flow-unassigned { border-style: dashed; }
.degree-flow-unassigned p { color: var(--muted); }
.degree-flow-empty { padding: .75rem 1rem; }
@media (max-width: 620px) {
  .degree-flow-root { margin-bottom: 1.5rem; }
  .degree-flow-root::after { height: 1.5rem; }
  .degree-flow-branches { grid-template-columns: 1fr; }
}

/* Shared configuration ordering: grips and precise placement bars, never arrow buttons. */
:is(.nav-editor-grip, .group-drag-handle, [data-type-grip], .kb-list-grip, [data-kb-card-grip]) { cursor: grab; touch-action: none; }
.order-is-dragging { user-select: none; cursor: grabbing; }
.order-dragging { opacity: .55; }
.order-preview { position: fixed; pointer-events: none; z-index: 10000; max-width: 20rem; padding: .5rem .75rem; border: 1px solid var(--accent); border-radius: var(--control-radius); background: var(--surface); color: var(--accent); box-shadow: var(--dialog-shadow); font-size: .875rem; }
:is(.order-before, .order-after, .order-inside, .order-left, .order-right) { position: relative; }
:is(.order-before, .order-after, .order-inside, .order-left, .order-right)::after { content: ''; position: absolute; background: var(--accent); border-radius: 2px; pointer-events: none; z-index: 5; }
.order-before::after { height: 3px; left: 0; right: 0; top: -4px; }
:is(.order-after, .order-inside)::after { height: 3px; left: 0; right: 0; bottom: -4px; }
.order-left::after { width: 3px; top: 0; bottom: 0; left: -5px; }
.order-right::after { width: 3px; top: 0; bottom: 0; right: -5px; }
.order-inside { background: var(--accent-soft); }

/* Existing degree and native drag fallbacks use the same 3px placement treatment. */
.degree-drop-active { position: relative; outline: 0; box-shadow: inset 0 -3px var(--accent); }
.kb-drop-before { border-top: 0; box-shadow: 0 -3px var(--accent); }
.kb-drop-after { border-bottom: 0; box-shadow: 0 3px var(--accent); }

/* Board management uses the shared icon row, modal surfaces and ordering grips. */
.board-table-scroll { max-width: 100%; overflow-x: auto; }
.board-table-scroll .listing { border-collapse: separate; border-spacing: 0 var(--space-2); }
.board-table-scroll .listing th, .board-table-scroll .listing td { border-bottom: 0; }
.board-table-scroll .listing tr > :first-child { border-radius: var(--radius) 0 0 var(--radius); }
.board-table-scroll .listing tr > :last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.board-table-scroll [data-board-row]:is(:hover, :focus-within) { background: transparent; }
.board-table-scroll [data-board-row]:is(:hover, :focus-within) > td { background: var(--accent-soft); }
.board-management-actions { width: 1%; }
.board-management-actions .action-row { flex-wrap: nowrap; }
.board-order-grip { touch-action: none; cursor: grab; }
.board-order-grip:active { cursor: grabbing; }
.board-management-dialog { width: min(560px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--dialog-radius); background: var(--surface-raised); color: var(--text); box-shadow: var(--dialog-shadow); }
.board-management-dialog::backdrop { background: rgb(0 0 0 / 40%); }
.board-management-dialog > .row { gap: var(--space-3); margin-bottom: var(--space-4); }
.board-management-dialog h2 { flex: 1; min-width: 0; margin: 0; overflow-wrap: anywhere; }
[data-board-management][aria-busy=true] [data-board-order-list] { opacity: .8; }

/* Feed moderation stays compact; secondary actions never sit inside the primary link. */
.post-admin-actions { margin-left: auto; flex: 0 0 auto; }
.feed-admin-toolbar { justify-content: flex-end; margin-bottom: var(--space-2); }
.feed-activity-row { display: flex; align-items: center; gap: var(--space-1); margin-bottom: var(--space-1); border-radius: var(--control-radius); }
.feed-activity-row > .feed-activity { flex: 1; min-width: 0; margin-bottom: 0; }
.feed-activity-actions { flex: 0 0 auto; flex-wrap: nowrap; gap: var(--space-1); }
@media (max-width: 480px) { .feed-activity-row .feed-activity-time { display: none; } }

/* Small pop-up with icon actions shown when a calendar event is clicked. */
.cal-popup { width: min(340px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; padding: var(--space-4, 1rem); border: 1px solid var(--line); border-radius: var(--dialog-radius); background: var(--surface-raised); color: var(--text); box-shadow: var(--dialog-shadow); }
.cal-popup:not([open]) { display: none; }
.cal-popup::backdrop { background: rgb(8 25 48 / 30%); }
.cal-popup [hidden] { display: none !important; }
.cal-popup p { margin: .25rem 0; }
.cal-popup h2 { font: 650 1.1rem var(--sans); margin: 0; min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.cal-popup h2::before { display: none; }
.cal-popup-head { display: flex; align-items: flex-start; gap: .6rem; margin-bottom: .4rem; }
.cal-popup-head .icon-button { flex: none; margin: -.25rem -.35rem 0 0; }
.cal-popup-swatch { flex: none; width: .75rem; height: .75rem; margin-top: .4rem; border-radius: 50%; background: var(--event-color); }
.cal-popup-when { font-weight: 600; }
.cal-popup-actions { margin-top: .8rem; justify-content: flex-end; }
.cal-popup .cal-scope-choice { margin: .6rem 0; }
.cal-popup.cal-popup-medium { width: min(440px, calc(100vw - 2rem)); }
.cal-popup.cal-popup-wide { width: min(620px, calc(100vw - 2rem)); }
.cal-popup-form form { margin: 0; }
.cal-popup-form .cal-form-dates { flex-wrap: wrap; }
.cal-popup .cal-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.cal-popup .cal-location-map img { max-width: 100%; height: auto; }
.cal-category-menu { position: fixed; inset: auto; margin: 0; min-width: 200px; max-width: min(300px, calc(100vw - 16px)); max-height: min(360px, calc(100dvh - 16px)); overflow: auto; padding: var(--space-2, .5rem); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-raised); color: var(--text); box-shadow: var(--dialog-shadow); }
.cal-category-menu:not(:popover-open) { display: none; }
.cal-category-menu p { margin: .1rem .4rem .35rem; }
.cal-category-menu ul { margin: 0; padding: 0; list-style: none; }
.cal-category-menu .cal-scope-choice { margin: 0 0 .4rem; padding: .25rem .5rem; }
.cal-category-option { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem .6rem; border: 0; border-radius: var(--control-radius); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.cal-category-option > span:nth-child(2) { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.cal-category-option:hover, .cal-category-option:focus-visible { background: var(--accent-soft); }
.cal-category-option[aria-pressed="true"] { font-weight: 650; }
.cal-category-option .cal-popup-swatch { margin-top: 0; }
.cal-mobile-category-manage { justify-content: flex-end; margin-top: .25rem; }
.cal-category-list { display: flex; flex-direction: column; gap: var(--space-2, .5rem); }
.cal-category-row { display: flex; align-items: flex-start; gap: .25rem; }
.cal-category-row > .cal-category-card { flex: 1 1 auto; min-width: 0; margin: 0; }
.category-order-grip { flex: none; margin-top: .55rem; touch-action: none; cursor: grab; }
.category-order-grip:active { cursor: grabbing; }

/* Multi-day all-day events read as one solid bar across their days. */
.cal-day { --cal-pad: .35rem; }
@media (max-width: 600px) { .cal-day { --cal-pad: 2px; } }
.cal-week-all-day { --cal-pad: 3px; }
.cal-event.cal-span { position: relative; z-index: 1; }
.cal-event.cal-span-open-left { margin-left: calc(-1 * var(--cal-pad)); border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-event.cal-span-open-right { margin-right: calc(-1 * var(--cal-pad) - 1px); border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-week-all-day .cal-event.cal-span-open-left { margin-left: calc(-1 * var(--cal-pad) - 1px); }
.cal-week-all-day .cal-event.cal-span-open-right { margin-right: calc(-1 * var(--cal-pad)); }
.cal-event.cal-span-continued .cal-event-title { visibility: hidden; }
.cal-span-spacer { visibility: hidden; pointer-events: none; }
.cal-event.cal-span:not(.cal-span-continued) { overflow: visible; z-index: 2; }
.cal-event.cal-span:not(.cal-span-continued) .cal-event-title { flex: none; position: relative; z-index: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: calc(var(--span-days, 1) * 100% + (var(--span-days, 1) - 1) * (2 * var(--cal-pad) + 11px) - 5px); }

/* Phones: a bottom tab bar replaces the wrapped header navigation. */
.tabbar { display: none; }
@media (max-width: 700px) {
  body { padding-bottom: calc(3.75rem + env(safe-area-inset-bottom, 0px)); }
  .top .nav { display: none; }
  .top { padding: .5rem .85rem; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--masthead); color: var(--masthead-text); border-top: 1px solid color-mix(in srgb, var(--masthead-gold) 35%, transparent); }
  .tabbar > a, .tabbar > button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; min-height: 3.75rem; padding: .4rem .2rem; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; font-size: .68rem; line-height: 1.1; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .tabbar > a:hover, .tabbar > button:hover, .tabbar > :is(a, button):focus-visible { background: var(--masthead-hover); }
  .tabbar > .active { color: var(--masthead-gold); font-weight: 650; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar .badge { position: absolute; top: .3rem; left: calc(50% + .55rem); margin: 0; }
  .more-sheet[popover] { position: fixed; inset: auto 0 calc(3.75rem + env(safe-area-inset-bottom, 0px)) 0; margin: 0; width: auto; max-height: min(72dvh, 560px); overflow: auto; padding: .5rem .5rem .75rem; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--dialog-radius) var(--dialog-radius) 0 0; background: var(--surface-raised); color: var(--text); box-shadow: var(--dialog-shadow); }
  .more-sheet:not(:popover-open) { display: none; }
  .more-sheet::backdrop { background: rgb(8 25 48 / 30%); }
}
.more-sheet > a, .more-sheet > form > button { display: flex; align-items: center; gap: .8rem; width: 100%; min-height: 2.9rem; padding: .55rem .75rem; border: 0; border-radius: var(--control-radius); background: transparent; color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.more-sheet > form { margin: 0; }
.more-sheet > a:hover, .more-sheet > a:focus-visible, .more-sheet > form > button:hover, .more-sheet > form > button:focus-visible { background: var(--accent-soft); }
.more-sheet > a.active { font-weight: 650; background: var(--accent-soft); }
.more-sheet .badge { margin-left: auto; }
.more-heading { margin: .6rem .75rem .2rem; color: var(--muted); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }

/* "Now" line in the day and week timelines. */
.cal-now-line { position: absolute; left: 0; right: 0; height: 2px; margin-top: -1px; background: var(--danger, #d9443f); z-index: 4; pointer-events: none; }
.cal-now-line::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: inherit; }

/* Friendly empty states. */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: var(--space-6, 2rem) var(--space-4, 1rem); text-align: center; color: var(--muted); }
.empty-mark { width: 2.4rem; height: 2.4rem; margin-bottom: .25rem; background: var(--gold); opacity: .8; -webkit-mask: url('/static/gavel.svg') center / contain no-repeat; mask: url('/static/gavel.svg') center / contain no-repeat; }
.empty-title { margin: 0; color: var(--text); font-weight: 600; }
.empty-hint { margin: 0; max-width: 34rem; }
.empty-action { justify-content: center; margin-top: .4rem; }

/* Category access: a single border; the group list only appears when it applies. */
.cal-access { display: flex; flex-direction: column; gap: .6rem; margin: 0; }
.cal-access > fieldset[hidden] { display: none; }
.cal-access .check { font-weight: 400; }
/* Headings focused by script (after a pop-up loads) are not controls, so they get no ring. */
.cal-popup h2[tabindex="-1"]:focus { outline: none; }
/* Loading placeholder inside the calendar pop-up. */
.skeleton { display: flex; flex-direction: column; gap: .6rem; padding: .25rem 0 .5rem; }
.skeleton > span { display: block; height: .9rem; border-radius: 999px; background: linear-gradient(90deg, var(--control-hover) 25%, var(--accent-soft) 50%, var(--control-hover) 75%); background-size: 200% 100%; animation: skeleton-shimmer 1.2s ease-in-out infinite; }
.skeleton > span:nth-child(1) { width: 85%; } .skeleton > span:nth-child(2) { width: 60%; } .skeleton > span:nth-child(3) { width: 72%; }
@keyframes skeleton-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton > span { animation: none; } }

/* The card dialog has its own sticky close icon; the heading's copy would double it. */
.kb-card-dialog .page-heading-control { display: none; }
.kb-card-dialog .action-row > [data-kb-close-card] { display: none; }

/* In-place editing of a single field (see InlineEdit): the value reads as text until it is edited. */
.inline-edit { display: flex; align-items: center; gap: .25rem; min-width: 0; margin: 0; }
.inline-edit-input { flex: 1 1 auto; min-width: 0; width: 100%; padding: .3rem .4rem; border: 1px solid transparent; border-radius: var(--control-radius); background: transparent; color: inherit; font: inherit; text-overflow: ellipsis; cursor: text; }
.inline-edit-heading .inline-edit-input { font: 650 .95rem var(--sans); }
.inline-edit-input:hover { border-color: var(--line); }
.inline-edit-input:focus { background: var(--surface); border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.inline-edit-actions { display: none; flex: none; align-items: center; gap: .1rem; }
.inline-edit:focus-within .inline-edit-actions, .inline-edit[data-dirty] .inline-edit-actions { display: inline-flex; }
.kb-list-header { flex-wrap: nowrap; }
.kb-list-header .inline-edit { flex: 1 1 auto; }
.kb-list-header .inline-edit .tag { flex: none; }
.kb-list-delete { margin: 0; flex: none; }
/* While a list name is being edited, its count and the other header icons step aside so the name has room. */
.kb-list-header:is(:has(.inline-edit:focus-within), :has(.inline-edit[data-dirty])) :is(.tag, .kb-list-delete, .kb-list-grip) { display: none; }

/* "For you": the home card of what needs a member's attention. */
.for-you { padding: var(--space-4, 1rem) var(--space-5, 1.25rem); }
.for-you > h2 { margin: 0 0 var(--space-3, .75rem); font-size: 1.05rem; }
.for-you-clear { margin: 0; }
.for-you-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: var(--space-4, 1rem) var(--space-5, 1.25rem); }
.for-you-block { min-width: 0; }
.for-you-block > header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .25rem; }
.for-you-block h3 { display: flex; align-items: center; gap: .45rem; margin: 0; color: var(--muted); font: 650 .78rem var(--sans); letter-spacing: .04em; text-transform: uppercase; }
.for-you-block h3 svg { width: 16px; height: 16px; }
.for-you-list { margin: 0; padding: 0; list-style: none; }
.for-you-row { display: flex; align-items: center; gap: .55rem; padding: .5rem .55rem; border-radius: var(--control-radius); color: inherit; text-decoration: none; }
.for-you-row:hover, .for-you-row:focus-visible { background: var(--accent-soft); text-decoration: none; }
.for-you-dot { flex: none; width: .6rem; height: .6rem; border-radius: 50%; background: var(--event-color); }
.for-you-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.for-you-sub { overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: .8rem; font-weight: 400; }
.for-you-meta { flex: none; color: var(--muted); font-size: .8rem; text-align: right; }
.for-you-overdue .for-you-meta { color: var(--danger); font-weight: 600; }
/* Phones show the first three of each list so the feed stays within easy reach. */
@media (max-width: 600px) { .for-you-list > li:nth-child(n+4) { display: none; } }

/* Task owners: a compact picker on each task row and a quiet name on read-only task lists. */
.kb-owner-select { width: 100%; min-width: 0; padding: .25rem; font-size: .8rem; background: transparent; border-color: var(--line); }
.kb-task-owner-form { margin: 0; min-width: 0; }
.kb-add-task .kb-owner-select { flex: 0 1 140px; width: 140px; }
.kb-task-owner { flex: none; max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: .05rem .45rem; border-radius: 999px; background: var(--control-hover); color: var(--muted); font-size: .65rem; }

/* "For you" lives at the top of the right column: one column, details under each title. */
.side .for-you-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-3, .75rem); }
.side .for-you { padding: var(--space-3, .75rem); }
.side .for-you .for-you-list a.for-you-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .1rem .5rem; padding: .45rem .4rem; }
.side .for-you-main { flex: 1 1 calc(100% - 1.4rem); }
.side .for-you-meta { flex: 1 1 100%; text-align: left; }
.side .for-you-dot { margin-top: .35rem; }
.side .for-you-dot ~ .for-you-meta { padding-left: 1.1rem; }
/* On phones the right column falls under the feed, except For you, which stays first. */
@media (max-width: 760px) {
  .frame > .side { display: contents; }
  .frame > .side > .for-you { order: -1; }
  .side .for-you .for-you-list a.for-you-row { flex-wrap: nowrap; align-items: center; }
  .side .for-you-main { flex: 1 1 auto; }
  .side .for-you-meta { flex: none; text-align: right; }
  .side .for-you-dot ~ .for-you-meta { padding-left: 0; }
}

/* A press outside content that holds unsaved input does not close it; it nudges instead (see dismiss.js). */
@keyframes dismiss-nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.dismiss-nudge { animation: dismiss-nudge .28s ease-in-out; }
@media (prefers-reduced-motion: reduce) { .dismiss-nudge { animation: none; outline: 2px solid var(--accent); outline-offset: 2px; } }

/* Event attendance: three answers with counts, a who-answered list, and quiet markers on calendar chips. */
.cal-attendance { margin: .6rem 0 .2rem; }
.cal-rsvp { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; }
.cal-rsvp-button { width: auto; min-width: 2.6rem; gap: .35rem; padding-inline: .55rem; }
.cal-rsvp-count { font-size: .8rem; font-weight: 600; min-width: .6rem; }
.cal-rsvp-button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-rsvp-button.cal-rsvp-declined[aria-pressed="true"] { background: var(--danger-soft); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.cal-rsvp-button:disabled { opacity: .45; cursor: not-allowed; }
.cal-attendees { margin-top: .4rem; }
.cal-attendees > summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.cal-attendees p { margin: .25rem 0; overflow-wrap: anywhere; }
.cal-rsvp-mark { flex: none; display: inline-flex; margin-left: .2rem; color: var(--accent); }
.cal-rsvp-mark svg { width: 12px; height: 12px; }
.cal-event.cal-rsvp-declined { opacity: .55; }
.cal-event.cal-rsvp-declined .cal-event-title { text-decoration: line-through; }

/* ---------- chat pop-up: a sticky, movable, non-modal window on every screen ---------- */
.chat-launcher { position: fixed; z-index: 65; right: 1rem; bottom: 1rem; display: inline-flex; align-items: center; justify-content: center; width: 3rem; height: 3rem; padding: 0; border: 1px solid color-mix(in srgb, var(--masthead-gold) 45%, transparent); border-radius: 50%; background: var(--masthead); color: var(--masthead-gold); box-shadow: 0 6px 18px rgb(0 0 0 / 22%); cursor: pointer; }
.chat-launcher:hover, .chat-launcher:focus-visible { background: var(--masthead-hover); }
.chat-launcher svg { width: 22px; height: 22px; }
.chat-launcher .badge { position: absolute; top: -.2rem; right: -.2rem; margin: 0; }
.chat-launcher[hidden], .chat-popup[hidden], .chat-launcher .badge[hidden], .chat-popup .badge[hidden], .chat-popup-body[hidden] { display: none; }
.chat-popup { position: fixed; z-index: 65; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; min-width: 280px; min-height: 0; max-width: calc(100vw - 8px); max-height: calc(100vh - 8px); border: 1px solid var(--line); border-radius: var(--dialog-radius); background: var(--surface-raised); color: var(--text); box-shadow: 0 12px 36px rgb(0 0 0 / 24%); overflow: hidden; resize: both; }
.chat-popup.is-min { resize: none; height: auto; min-height: 0; }
.chat-popup.is-moving { outline: 2px solid var(--accent); outline-offset: -2px; }
.chat-popup.is-dragging { user-select: none; opacity: .96; }
.chat-popup-head { display: flex; align-items: center; gap: .25rem; padding: .35rem .5rem; border-bottom: 1px solid var(--line); background: var(--surface); touch-action: none; cursor: grab; flex-shrink: 0; }
.chat-popup.is-min .chat-popup-head { border-bottom: 0; }
.chat-popup.is-dragging .chat-popup-head { cursor: grabbing; }
.chat-popup-head h2 { margin: 0 auto 0 .15rem; font: 600 .95rem var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-popup-head select { width: auto; max-width: 7.5rem; min-height: 0; padding: .2rem .4rem; font-size: .85rem; }
.chat-popup-head #chat-popup-move[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.chat-popup-body { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: .5rem .6rem .6rem; gap: .4rem; }
.chat-popup-status { margin: 0; }
.chat-popup-log { flex: 1; height: auto; min-height: 5rem; }
.chat-popup-form { display: flex; align-items: center; gap: .25rem; margin: 0; }
.chat-popup-form input { flex: 1; min-width: 0; }
@media (max-width: 700px) {
  /* Phones: a full-width sheet above the tab bar; position and size are not user-adjustable. */
  .chat-launcher { right: .75rem; bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px)); }
  .chat-popup { inset: 0 0 calc(3.75rem + env(safe-area-inset-bottom, 0px)) 0 !important; width: auto !important; height: auto !important; max-width: none; max-height: none; border-radius: 0; border-width: 1px 0; resize: none; }
  .chat-popup.is-min { inset: auto 0 calc(3.75rem + env(safe-area-inset-bottom, 0px)) 0 !important; }
  .chat-popup-head { cursor: default; }
  #chat-popup-move { display: none; }
}
@media print { .chat-launcher, .chat-popup { display: none; } }

/* ---------- post to thread pop-up ---------- */
.post-thread-dialog { width: min(480px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--dialog-radius); background: var(--surface-raised); color: var(--text); box-shadow: var(--dialog-shadow); }
.post-thread-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.post-thread-head h2 { margin: 0; font-size: 1.05rem; }
.post-thread-body label { display: grid; gap: .25rem; }

/* ---------- Files: folders, tags, grid and list ---------- */
.files-layout { position: relative; display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.files-side { position: sticky; top: var(--space-3); display: grid; gap: var(--space-2); max-height: calc(100dvh - 2rem); overflow: auto; padding: var(--space-3); }
.files-side-head { display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-2); }
.files-side-head h2 { margin: 0; }
.folder-tree { display: grid; gap: 2px; }
.folder-tree .folder-tree { margin-left: .85rem; padding-left: .35rem; border-left: 1px solid var(--line); }
.folder-tree li { position: relative; }
.folder-link { display: flex; align-items: center; gap: .5rem; min-height: 2.25rem; padding: .25rem .5rem; border-radius: var(--control-radius); color: var(--text); text-decoration: none; transition: background .15s, transform .15s; }
.folder-link svg { flex: none; color: var(--gold); }
.folder-link .folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-count { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.folder-link:hover, .folder-link:focus-visible { background: var(--accent-soft); }
.folder-link.is-active { background: var(--accent-soft); font-weight: 650; box-shadow: inset 3px 0 0 var(--accent); }
.is-drop-target { background: var(--accent-soft) !important; outline: 2px dashed var(--accent); outline-offset: -2px; transform: scale(1.02); }
.files-main { display: grid; gap: var(--space-3); min-width: 0; }
.files-crumbs { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.files-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .4rem; margin: 0; font-size: .95rem; }
.files-crumbs li + li::before { content: '›'; margin-right: .4rem; color: var(--muted); }
.files-crumbs li[aria-current] { font-weight: 650; }
.files-toolbar { display: flex; align-items: center; gap: var(--space-2); }
.files-toolbar input[type=search] { flex: 1; min-width: 0; }
.files-toolbar select { width: auto; }
.view-toggle { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--control-radius); background: var(--control-hover); }
.view-toggle .icon-button[aria-pressed=true] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.files-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.files-chips .chip { text-decoration: none; }
.files-chips .chip.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 650; }
.folder-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: var(--space-3); }
.folder-tile { display: grid; grid-template-columns: auto 1fr; gap: 0 .6rem; align-items: center; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; transition: transform .15s, border-color .15s, background .15s; }
.folder-tile svg { grid-row: span 2; width: 28px; height: 28px; color: var(--gold); }
.folder-tile .folder-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-tile:hover, .folder-tile:focus-visible { background: var(--accent-soft); border-color: var(--accent); transform: translateY(-2px); }
.files-none { margin: 0; }
.files-items { display: grid; gap: var(--space-3); }
.files-items[data-view=grid] { grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); }
.file-card { position: relative; display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); align-content: start; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: transform .15s, border-color .15s, background .15s; }
.file-card:hover { background: var(--accent-soft); border-color: var(--accent); transform: translateY(-2px); }
.file-card[draggable=true] { cursor: grab; }
.file-card.is-dragging { opacity: .45; }
.file-card.is-selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.file-card .action-row { grid-column: 1 / -1; justify-content: flex-end; flex-wrap: nowrap; }
.file-card .file-kind { flex: none; width: 3rem; height: 3.5rem; display: grid; place-items: center; padding: 0; border-radius: 10px; color: #fff; border: 0; background: var(--kind, var(--accent)); }
.file-kind-pdf { --kind: #c0392b; } .file-kind-word { --kind: #2b6cb0; } .file-kind-excel { --kind: #2f855a; } .file-kind-powerpoint { --kind: #c05621; } .file-kind-text { --kind: #5b6b7e; }
.file-select { position: absolute; top: .45rem; right: .5rem; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; opacity: 0; transition: opacity .15s; cursor: pointer; }
.file-card:hover .file-select, .file-card:focus-within .file-select, .is-selecting .file-select, .file-select:has(:checked) { opacity: 1; }
.file-select input { width: 1.1rem; height: 1.1rem; margin: 0; cursor: pointer; }
.file-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.file-where a { display: inline-flex; align-items: center; gap: .25rem; margin-right: .5rem; }
.file-where svg { width: 14px; height: 14px; }
.files-items[data-view=list] { gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.files-items[data-view=list] .file-card { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; border: 0; border-radius: 0; background: transparent; transform: none; }
.files-items[data-view=list] .file-card + .file-card { border-top: 1px solid var(--line); }
.files-items[data-view=list] .file-card:hover { background: var(--accent-soft); }
.files-items[data-view=list] .file-card .action-row { grid-column: auto; }
.files-items[data-view=list] .file-card .file-kind { width: 2.6rem; height: 2.6rem; font-size: .65rem; }
.files-items[data-view=list] .file-select { position: static; opacity: 1; order: -1; }
.tag-chip { --tag: #2b6cb0; display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border: 1px solid color-mix(in srgb, var(--tag) 45%, var(--line)); border-radius: var(--pill-radius); background: color-mix(in srgb, var(--tag) 14%, var(--surface)); color: var(--text); font-size: .8rem; line-height: 1.5; }
.tag-chip a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.tag-chip a:hover, .tag-chip a:focus-visible { text-decoration: underline; }
.tag-chip.is-active { border-color: var(--tag); box-shadow: 0 0 0 1px var(--tag); font-weight: 650; }
.tag-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--tag); flex: none; }
.tag-remove { margin-left: .1rem; padding: 0 .2rem; font-size: 1rem; line-height: 1; }
.tag-blue { --tag: #2b6cb0; } .tag-green { --tag: #2f855a; } .tag-gold { --tag: #b7791f; } .tag-red { --tag: #c53030; }
.tag-purple { --tag: #6b46c1; } .tag-teal { --tag: #1d8a8a; } .tag-pink { --tag: #b83280; } .tag-gray { --tag: #5b6b7e; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .35rem .5rem; align-items: center; }
.tag-manager { display: grid; gap: var(--space-3); }
.tag-manager li { display: grid; gap: .3rem; padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.tag-manager-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.files-actionbar { position: fixed; z-index: 64; left: 50%; bottom: 1.25rem; transform: translateX(-50%); display: flex; align-items: center; gap: var(--space-2); padding: .4rem .75rem; border: 1px solid var(--line); border-radius: var(--pill-radius); background: var(--surface-raised); box-shadow: var(--dialog-shadow); }
.files-actionbar[hidden], .files-dropzone[hidden], .view-toggle[hidden] { display: none; }
.files-dropzone { position: fixed; z-index: 66; inset: .75rem; display: grid; place-content: center; justify-items: center; gap: .5rem; border: 3px dashed var(--accent); border-radius: var(--dialog-radius); background: color-mix(in srgb, var(--accent-soft) 90%, transparent); color: var(--accent); font-size: 1.2rem; font-weight: 650; pointer-events: none; }
.files-dropzone svg { width: 40px; height: 40px; }
.files-status { margin: 0; padding: .5rem .75rem; border-radius: var(--control-radius); background: var(--accent-soft); }
.files-dialog { width: min(480px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--dialog-radius); background: var(--surface-raised); color: var(--text); box-shadow: var(--dialog-shadow); }
.files-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.files-dialog-head h2 { margin: 0; font-size: 1.05rem; }
.files-dialog-body label:not(.check) { display: grid; gap: .25rem; }
.folder-picker { display: grid; gap: .1rem; max-height: 16rem; overflow: auto; }
@media (max-width: 800px) {
  .files-layout { grid-template-columns: minmax(0, 1fr); }
  .files-side { position: static; max-height: none; }
  .files-actionbar { bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px)); }
  .files-toolbar { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .folder-tile, .file-card, .folder-link { transition: none; } .folder-tile:hover, .file-card:hover, .is-drop-target { transform: none; } }
.files-side-toggle { display: none; cursor: pointer; list-style: none; font-weight: 650; padding: .15rem 0; }
@media (max-width: 800px) {
  .files-side-toggle { display: flex; align-items: center; gap: .5rem; min-height: 2.25rem; }
  .files-side:not([open]) > :not(summary) { display: none; }
}
@media (max-width: 800px) { .files-toolbar input[type=search] { flex: 1 1 100%; } }
.degree-candidate { display: grid; gap: var(--space-2); }
.degree-candidate label { display: grid; gap: .25rem; }
.degree-candidate [hidden] { display: none; }

/* ---------- Degree Planner: member answers ---------- */
.answer-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border: 1px solid var(--line); border-radius: var(--pill-radius); font-size: .8rem; line-height: 1.5; white-space: nowrap; }
.answer-chip svg { width: 14px; height: 14px; }
.answer-accepted { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); color: var(--text); }
.answer-accepted svg { color: var(--ok); }
.answer-declined { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); color: var(--danger); font-weight: 600; }
.answer-awaiting { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); color: var(--text); }
.answer-awaiting svg { color: var(--warn); }
.answer-line { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.degree-answer-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0; }
.degree-answer-name { flex: 1 1 10rem; font-weight: 600; }
.degree-slot-answer { display: inline-flex; align-items: center; gap: .25rem; }
/* The two answer buttons and the awaiting marker share one square box so the icons sit evenly. */
/* The three answer toggles share one square box and keep their own color (green yes, red no, yellow awaiting):
   subdued when not chosen, bold (full color, heavier stroke) when chosen. No filled box or outline marks the choice. */
.degree-slot-answer .icon-button { box-sizing: border-box; width: var(--control-size); min-width: 0; height: var(--control-size); padding: 0; justify-content: center; color: var(--c); background: transparent; box-shadow: none; opacity: .4; }
.degree-slot-answer .icon-button svg { transition: stroke-width .12s; }
.degree-slot-answer .icon-button:hover:not(:disabled) { opacity: .8; background: color-mix(in srgb, var(--c) 10%, transparent); }
.degree-slot-answer .icon-button[aria-pressed="true"] { opacity: 1; background: transparent; box-shadow: none; color: var(--c); }
.degree-slot-answer .icon-button[aria-pressed="true"] svg { stroke-width: 2.8; }
.degree-slot-answer .icon-button:disabled { opacity: .2; }
.degree-slot-answer .icon-button[aria-pressed="true"]:disabled { opacity: .7; }
.answer-yes { --c: var(--ok); } .answer-no { --c: var(--no); } .answer-wait { --c: var(--warn); }
.degree-row-assignment .degree-slot-answer { justify-self: start; }

/* ---------- Reaction delight: a springy picker and lively chips (the burst itself is public/reaction-fx.js) ---------- */
.reaction-picker[open] .reaction-options { transform-origin: bottom left; animation: reaction-panel .22s cubic-bezier(.2, .9, .3, 1.25); }
.reaction-picker[open] .reaction-option { animation: reaction-option-in .38s cubic-bezier(.2, 1.5, .4, 1) backwards; animation-delay: calc(var(--i, 0) * 16ms + 40ms); }
.reaction-option { transition: scale .18s cubic-bezier(.3, 1.7, .5, 1), translate .18s cubic-bezier(.3, 1.7, .5, 1), background .12s; }
.reaction-option:hover, .reaction-option:focus-visible { scale: 1.4; translate: 0 -5px; position: relative; z-index: 1; }
.reaction-option:active { scale: 1.05; translate: 0 0; }
.reaction-chip .reaction-emoji { display: inline-block; transition: scale .16s cubic-bezier(.3, 1.7, .5, 1); }
.reaction-chip:hover .reaction-emoji { scale: 1.25; }
.reaction-chip .reaction-count { display: inline-block; min-width: .6em; font-variant-numeric: tabular-nums; }
.reaction-chip.chip-on .reaction-emoji { filter: drop-shadow(0 1px 2px color-mix(in srgb, var(--accent) 45%, transparent)); }
.reaction-picker > summary .reaction-emoji, .reaction-picker > summary svg { transition: scale .18s cubic-bezier(.3, 1.7, .5, 1), rotate .25s ease; }
.reaction-picker > summary:hover svg { scale: 1.2; rotate: -8deg; }
.reaction-picker[open] > summary svg { rotate: 12deg; scale: 1.15; }
@keyframes reaction-panel { from { opacity: 0; scale: .7; translate: 0 10px; } to { opacity: 1; scale: 1; translate: 0 0; } }
@keyframes reaction-option-in { from { opacity: 0; scale: .2; translate: 0 14px; } to { opacity: 1; scale: 1; translate: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .reaction-picker[open] .reaction-options, .reaction-picker[open] .reaction-option { animation: none; }
  .reaction-option, .reaction-chip .reaction-emoji, .reaction-picker > summary svg { transition: none; }
  .reaction-option:hover, .reaction-option:focus-visible, .reaction-chip:hover .reaction-emoji, .reaction-picker > summary:hover svg, .reaction-picker[open] > summary svg { scale: 1; translate: 0 0; rotate: 0deg; }
}

/* ---------- Gallery: justified rows, a full-screen viewer and tags ---------- */
.gallery-toolbar { margin-bottom: var(--space-2); }
.gallery-count { margin-left: auto; }
.photo-month-title { position: sticky; top: .5rem; z-index: 3; width: fit-content; margin: var(--space-5) 0 var(--space-2); padding: .3rem .8rem; border: 1px solid var(--line); border-radius: var(--pill-radius); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); font-size: .9rem; }
.photo-grid { --row: 210px; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.photo-grid::after { content: ''; flex-grow: 10000; }
.photo { position: relative; min-width: 0; flex: calc(var(--w) / var(--h) * 100) 1 calc(var(--w) / var(--h) * var(--row)); overflow: hidden; border-radius: 10px; background: var(--control-hover); }
.photo::before { content: ''; display: block; padding-bottom: calc(var(--h) / var(--w) * 100%); }
.photo > a { position: absolute; inset: 0; display: block; color: inherit; }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity .45s ease, transform .5s cubic-bezier(.2, .8, .2, 1); }
.gallery-ready .photo img:not(.is-loaded) { opacity: 0; }
.photo > a:hover img, .photo > a:focus-visible img { transform: scale(1.06); }
.photo > a:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
/* Videos in the grid: the poster picture (or a calm dark tile) with a play badge. */
.photo-blank { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, #16263c, #0b1420); }
.photo-play { position: absolute; inset: 0; display: grid; place-items: center; width: 3rem; height: 3rem; margin: auto; border-radius: 50%; background: rgb(8 14 24 / .7); color: #fff; pointer-events: none; }
.photo-play svg { width: 1.9rem; height: 1.9rem; }
.lightbox-image[hidden] { display: none; }
.lightbox-stage.is-video { cursor: default; }
.lightbox-stage .lightbox-video { width: min(100%, 72rem); background: #000; }
video.photo-page-image { width: 100%; max-height: 75vh; background: #0b1420; border-radius: var(--control-radius); }
.photo-cap { position: absolute; inset: auto 0 0 0; display: grid; gap: .25rem; padding: 1.8rem .6rem .5rem; color: #fff; background: linear-gradient(transparent, rgb(0 0 0 / .66)); opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; pointer-events: none; }
.photo > a:hover .photo-cap, .photo > a:focus-visible .photo-cap { opacity: 1; transform: none; }
.photo-cap b { font-size: .8rem; font-weight: 650; text-shadow: 0 1px 2px rgb(0 0 0 / .5); }
.photo-cap-tags { display: flex; flex-wrap: wrap; gap: .25rem; }
.photo-cap .tag-chip { padding: 0 .45rem; border-color: rgb(255 255 255 / .4); background: rgb(255 255 255 / .18); color: #fff; font-size: .7rem; }
@media (hover: none) { .photo-cap { opacity: 1; transform: none; padding-top: 1.2rem; } .photo-cap-tags { display: none; } }
.photo-more { display: flex; justify-content: center; width: fit-content; margin: var(--space-5) auto; padding: .5rem 1.2rem; border: 1px solid var(--line); border-radius: var(--pill-radius); background: var(--surface); color: var(--text); text-decoration: none; }
.photo-more:hover { background: var(--accent-soft); }
.photo-page-image { display: block; max-width: 100%; height: auto; margin-inline: auto; border-radius: var(--radius); }
.photo-tag-form .row { flex-wrap: nowrap; }
.photo-tag-form input[name=add] { flex: 1; min-width: 0; }
.tag-chip .tag-remove { border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; line-height: 1; padding: 0 .2rem; border-radius: 50%; }
.tag-chip .tag-remove:hover, .tag-chip .tag-remove:focus-visible { background: color-mix(in srgb, var(--tag) 25%, transparent); }

.lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: hidden; background: rgb(8 14 24 / .94); color: #f5f7fb; }
.lightbox[open] { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; grid-template-rows: minmax(0, 1fr); }
.lightbox.info-hidden[open] { grid-template-columns: minmax(0, 1fr); }
.lightbox::backdrop { background: rgb(0 0 0 / .8); }
.lightbox-stage { grid-area: 1 / 1; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; min-width: 0; min-height: 0; overflow: hidden; padding: 3.5rem 1rem 1rem; cursor: zoom-in; }
.lightbox-image { display: block; max-width: 100%; max-height: calc(100dvh - 4.75rem); width: auto; height: auto; object-fit: contain; border-radius: 4px; box-shadow: 0 12px 48px rgb(0 0 0 / .5); user-select: none; transition: filter .3s, transform .28s cubic-bezier(.2, .8, .2, 1); }
.lightbox-image.is-loading { filter: blur(3px); }
.lightbox-image.is-zoomed { cursor: zoom-out; }
.lightbox-bar { position: absolute; z-index: 2; inset: 0 0 auto 0; display: flex; align-items: center; justify-content: space-between; padding: .6rem .75rem; pointer-events: none; }
.lightbox-bar > * { pointer-events: auto; }
.lightbox-count { padding: .2rem .7rem; border-radius: var(--pill-radius); background: rgb(255 255 255 / .12); font-size: .8rem; font-variant-numeric: tabular-nums; }
.lightbox-actions { display: flex; gap: .25rem; }
.lightbox .lightbox-bar .icon-button, .lightbox .lightbox-nav { color: #f5f7fb; background: rgb(255 255 255 / .1); }
.lightbox .lightbox-bar .icon-button:hover, .lightbox .lightbox-nav:hover, .lightbox .icon-button:focus-visible { background: rgb(255 255 255 / .24); }
.lightbox .icon-button[aria-pressed="true"][data-lightbox="zoom"] { background: rgb(255 255 255 / .28); }
.lightbox-nav { position: absolute; z-index: 2; top: 50%; width: 3rem; height: 3rem; margin-top: -1.5rem; border-radius: 50%; transition: background .15s, transform .15s; }
.lightbox-prev { left: .75rem; } .lightbox-next { right: 21.75rem; }
.lightbox.info-hidden .lightbox-next { right: .75rem; }
.lightbox-nav:hover { transform: scale(1.08); }
.lightbox-info { grid-area: 1 / 2; overflow: auto; padding: 4rem 1rem 1rem; border-left: 1px solid rgb(255 255 255 / .12); background: #14223a; color: var(--text);
  --surface: #1a2a43; --surface-raised: #1a2a43; --bg: #0f1a2c; --text: #e5edf8; --muted: #a4b4cd; --line: #2c3d55; --accent: #91bdf3; --accent-soft: #203b60; --control-hover: #203550; --danger: #ff9ba4; }
.lightbox.info-hidden .lightbox-info { display: none; }
.lightbox-info[aria-busy="true"] { opacity: .5; }
@media (max-width: 800px) {
  .lightbox[open] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .lightbox-stage { padding: 3.5rem .5rem .5rem; }
  .lightbox-image { max-height: calc(100dvh - 4.5rem - 42dvh); }
  .lightbox.info-hidden .lightbox-image { max-height: calc(100dvh - 4.5rem); }
  .lightbox-info { grid-area: 2 / 1; max-height: 42dvh; padding: 1rem; border-left: 0; border-top: 1px solid rgb(255 255 255 / .12); }
  .lightbox-next { right: .5rem; } .lightbox-prev { left: .5rem; }
  .lightbox-nav { top: 38%; width: 2.6rem; height: 2.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .photo img, .photo-cap, .lightbox-image, .lightbox-nav { transition: none; }
  .photo > a:hover img, .photo > a:focus-visible img, .lightbox-nav:hover { transform: none; }
  .photo-month-title { backdrop-filter: none; }
}
@media (max-width: 700px) { .photo-grid { --row: 128px; gap: 4px; } .gallery-count { margin-left: 0; } }

/* ---------- Announcement banner pinned to the top of the feed ---------- */
.feed-banner { --tone: var(--accent); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-3); align-items: start; padding: var(--space-4); border: 1px solid color-mix(in srgb, var(--tone) 55%, var(--line)); border-left-width: 5px; border-radius: var(--radius); background: color-mix(in srgb, var(--tone) 12%, var(--surface)); }
.tone-info { --tone: var(--accent); } .tone-success { --tone: var(--ok); } .tone-warning { --tone: var(--warn); } .tone-urgent { --tone: var(--no); }
.feed-banner-icon { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: color-mix(in srgb, var(--tone) 22%, transparent); color: var(--tone); flex: none; }
.feed-banner-title { margin: 0; font-size: 1.05rem; }
.feed-banner-title a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.feed-banner-message { margin: .25rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.feed-banner-by { margin: .35rem 0 0; color: var(--muted); }
.banner-list { display: grid; gap: var(--space-3); }
.banner-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-3); align-items: start; padding: var(--space-3); border: 1px solid var(--line); border-left: 4px solid var(--tone); border-radius: var(--radius); background: var(--surface); }
.banner-row-main p { margin: .15rem 0 0; }
.banner-row-message { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 4.5em; overflow: hidden; }
.banner-tones { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.banner-tone .feed-banner-icon { width: 1.75rem; height: 1.75rem; }
.banner-tone input:checked ~ .feed-banner-icon { box-shadow: 0 0 0 2px var(--tone); }
@media (max-width: 600px) { .feed-banner, .banner-row { grid-template-columns: auto minmax(0, 1fr); } .feed-banner > .icon-button, .banner-row > .action-row { grid-column: 1 / -1; justify-self: end; } }
.feed-banner-title::before, .feed-banner-title::after { display: none !important; }
.feed-banner-title { padding-left: 0; }
/* The banner is a direct child of the frame: full width above both columns, and above For you on phones. */
.frame > .feed-banner { grid-column: 1 / -1; order: -2; margin-bottom: var(--space-2); }

/* ---------- Help and tutorial ---------- */
.help-layout { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.help-toc { position: sticky; top: var(--space-3); padding: var(--space-3); }
.help-toc summary { cursor: pointer; font-weight: 650; }
.help-toc ol { display: grid; gap: 2px; margin: var(--space-2) 0 0; }
.help-toc a { display: block; padding: .3rem .5rem; border-radius: var(--control-radius); color: var(--text); text-decoration: none; }
.help-toc a:hover, .help-toc a:focus-visible { background: var(--accent-soft); }
.help-main { display: grid; gap: var(--space-4); min-width: 0; font-size: 1.05rem; line-height: 1.65; }
.help-lead { margin: 0; padding: var(--space-4); border-radius: var(--radius); background: var(--accent-soft); }
.help-section { scroll-margin-top: var(--space-4); }
.help-section h2 { margin-top: 0; }
.help-section h3 { margin: var(--space-4) 0 var(--space-1); font-size: 1.05rem; }
.help-intro { color: var(--muted); }
.help-steps { counter-reset: step; list-style: none; display: grid; gap: var(--space-3); margin: var(--space-2) 0; padding: 0; }
.help-steps > li { counter-increment: step; position: relative; padding-left: 2.6rem; min-height: 1.9rem; }
.help-steps > li::before { content: counter(step); position: absolute; left: 0; top: .05rem; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: .95rem; }
.help-list { display: grid; gap: var(--space-2); padding-left: 1.2rem; }
.help-inline-icon { display: inline-flex; vertical-align: -.25em; margin-inline: .1rem; padding: .1rem; border-radius: 6px; background: var(--control-hover); color: var(--accent); }
.help-inline-icon svg { width: 1.1rem; height: 1.1rem; }
.help-tip { display: flex; gap: .6rem; align-items: flex-start; margin: var(--space-3) 0 0; padding: var(--space-3); border-left: 4px solid var(--gold); border-radius: var(--control-radius); background: color-mix(in srgb, var(--gold) 12%, var(--surface)); }
.help-tip-icon { color: var(--gold); flex: none; margin-top: .1rem; }
.help-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: var(--space-2) var(--space-4); }
.help-icons li { display: flex; gap: .75rem; align-items: flex-start; padding: .4rem .2rem; }
.help-icon { display: grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface-raised); color: var(--accent); }
.help-icon svg { width: 1.35rem; height: 1.35rem; }
.help-checklist { display: grid; gap: var(--space-2); }
.help-checklist label { display: flex; gap: .75rem; align-items: flex-start; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: background .15s, border-color .15s; }
.help-checklist label:hover { background: var(--accent-soft); }
.help-checklist label:has(:checked) { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.help-checklist label:has(:checked) span { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ok) 60%, transparent); }
.help-checklist input { width: 1.4rem; height: 1.4rem; margin-top: .15rem; flex: none; }
.help-progress { margin: var(--space-3) 0 0; font-weight: 650; }
.help-progress.is-complete { color: var(--ok); }
.help-glossary { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); margin: 0; }
.help-glossary dt { font-weight: 650; } .help-glossary dd { margin: 0; }
.welcome-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); background: color-mix(in srgb, var(--gold) 9%, var(--surface)); }
.welcome-card[hidden] { display: none; }
.welcome-card h2 { margin: 0; font-size: 1.05rem; }
.welcome-card h2::before { display: none; }
.welcome-card p { margin: .15rem 0 0; }
.welcome-icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--gold); }
@media (max-width: 800px) {
  .help-layout { grid-template-columns: minmax(0, 1fr); }
  .help-toc { position: static; }
  .help-main { font-size: 1.1rem; }
}
@media print { .help-toc, header.top, .tabbar, .chat-launcher, .chat-popup, footer.foot { display: none !important; } .help-layout { display: block; } .help-section { break-inside: avoid; box-shadow: none; } }

/* ---------- Member details ---------- */
.profile-title { margin: 0 0 .2rem; font-weight: 650; color: var(--gold); }
.member-title { color: var(--gold); font-size: .85rem; font-weight: 600; }
.member-contact { display: grid; gap: .25rem; margin-top: var(--space-2); }
.member-contact-compact { margin-top: .2rem; }
.member-contact-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; margin-right: .25rem; }
.member-address { white-space: pre-line; }
.reset-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: var(--space-4); }
.reset-option { padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); align-content: start; }
.reset-option h2 { margin: 0; font-size: 1.05rem; }
.member-actions { flex-wrap: nowrap; }

/* ---------- Calendar subscription ---------- */
.feed-url { flex: 1; min-width: 0; font-family: var(--mono); font-size: .85rem; }
.feed-link-box { padding: var(--space-4); border: 2px solid var(--ok); border-radius: var(--radius); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); display: grid; gap: var(--space-2); }
.feed-link-box .row { flex-wrap: nowrap; }
.feed-subscribe h2 { margin-bottom: 0; }
.feed-banner-actions { flex-wrap: nowrap; align-self: start; }
@media (max-width: 600px) { .feed-banner > .feed-banner-actions { grid-column: 1 / -1; justify-self: end; } }

/* ---------- Search ---------- */
.header-search { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; margin-left: auto; border-radius: 50%; color: var(--masthead-text); }
.header-search:hover, .header-search:focus-visible, .header-search.active { background: var(--masthead-hover); color: var(--masthead-gold); }
.search-page { display: grid; gap: var(--space-3); }
.search-form { display: flex; gap: var(--space-2); align-items: center; }
.search-form input { flex: 1; min-width: 0; font-size: 1.1rem; padding: .7rem 1rem; border-radius: var(--pill-radius); }
.search-intro p { margin: 0 0 .5rem; }
.search-intro kbd { padding: 0 .35rem; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-raised); font: inherit; font-size: .85em; }
.search-group h2 { margin: var(--space-3) 0 var(--space-2); font-size: 1.05rem; }
.search-list { padding: var(--space-1) var(--space-3); }
.search-hit { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) 0; }
.search-hit + .search-hit { border-top: 1px solid var(--line); }
.search-icon { display: grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; border-radius: var(--control-radius); background: var(--accent-soft); color: var(--accent); }
.search-thumb { flex: none; width: 3.5rem; height: 3.5rem; object-fit: cover; border-radius: var(--control-radius); background: var(--control-hover); }
.search-main { min-width: 0; flex: 1; }
.search-title { font-weight: 650; overflow-wrap: anywhere; }
.search-snippet { margin: .2rem 0 0; overflow-wrap: anywhere; }
.search-meta { margin: .2rem 0 0; }
.search-type { font-weight: 600; }
.search-page mark { padding: 0 .1em; border-radius: 3px; background: color-mix(in srgb, var(--gold) 35%, transparent); color: inherit; }
.search-more { margin: var(--space-2) 0 0; }
@media (max-width: 700px) { .header-search { width: 2.75rem; height: 2.75rem; } }
.search-hit { margin-inline: calc(var(--space-3) * -1); padding-inline: var(--space-3); border-radius: var(--control-radius); cursor: pointer; }
.search-hit:hover, .search-hit:focus-within { background: var(--accent-soft); }

/* Static pages (/pages): a list of full-row links like search results, and a readable page body. */
.page-list-head { justify-content: space-between; align-items: center; }
.site-page-list { list-style: none; margin: 0; padding: 0; }
.site-page-row { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3); margin-inline: calc(var(--space-3) * -1); border-radius: var(--control-radius); cursor: pointer; }
.site-page-row + .site-page-row { border-top: 1px solid var(--line); }
.site-page-row:hover, .site-page-row:focus-within { background: var(--accent-soft); }
.site-page-row p { margin: 0; }
.site-page-title { font-weight: 650; overflow-wrap: anywhere; }
.site-page .rich-text { font-size: 1.02rem; line-height: 1.6; }

/* Members list: each member's visible groups, and the "By group" sections. */
.member-groups { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .15rem; }
.member-groups .tag { margin-right: 0; }
.member-views { margin: .6rem 0 .2rem; }
.member-section { margin-top: 1rem; }
.member-section-title { margin: 0 0 .1rem; font-size: 1rem; }
.member-filter { margin: 0 0 .2rem; }
.people li .member-actions { margin-left: auto; flex: none; }
.member-section-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.member-section-head p { margin: 0; }

/* "Turn on notifications on this device" prompt (Feed and Alerts). The bell is deliberately large and filled. */
.push-prompt { display: flex; gap: var(--space-3, .75rem); align-items: flex-start; border-color: var(--accent); background: var(--accent-soft); }
.push-prompt[hidden] { display: none; }
.push-prompt-mark { display: grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; color: var(--accent); }
.push-prompt-mark svg { width: 1.6rem; height: 1.6rem; }
.push-prompt-body { flex: 1; min-width: 0; cursor: default; }
.push-prompt[data-push-state="off"] .push-prompt-body { cursor: pointer; }
.push-prompt-title { margin: 0 0 .25rem; font-size: 1.05rem; }
.push-prompt-body p { margin: .25rem 0; }
.push-prompt-steps { margin: .4rem 0 0; padding-left: 1.3rem; }
.push-prompt-steps li { margin: .25rem 0; }
.push-prompt-status { font-weight: 600; color: var(--accent); }
.push-prompt-actions { display: flex; flex-direction: column; gap: .4rem; align-items: center; flex: none; }
.push-prompt-go { display: grid; place-items: center; width: 3.4rem; height: 3.4rem; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-text); cursor: pointer; }
.push-prompt-go[hidden] { display: none; }
.push-prompt-go svg { width: 1.7rem; height: 1.7rem; }
.push-prompt-go:hover, .push-prompt-go:focus-visible { filter: brightness(1.12); outline: 2px solid var(--accent); outline-offset: 3px; }
.push-prompt-go:disabled { opacity: .6; cursor: progress; }
.push-prompt[data-push-state="done"] .push-prompt-mark { color: var(--ok, var(--accent)); }
@media (max-width: 700px) { .push-prompt { flex-wrap: wrap; } .push-prompt-actions { flex-direction: row; width: 100%; justify-content: flex-end; } }
@media (prefers-reduced-motion: no-preference) { .push-prompt-go { transition: filter .15s; } }
.push-prompt-title::before { display: none; }
.push-prompt [hidden] { display: none !important; }
.push-prompt[data-push-state="off"] .push-prompt-mark { display: none; }
[data-push-text] { white-space: pre-line; }

/* Admin: unused uploads and group messages */
.orphan-list, .group-message-list { list-style: none; margin: 0; padding: 0; }
.orphan-row { display: flex; gap: .75rem; align-items: center; padding: .5rem 0; border-top: 1px solid var(--line); }
.orphan-row:first-child { border-top: 0; }
.orphan-row p { margin: 0; }
.orphan-name { overflow-wrap: anywhere; }
.orphan-thumb { flex: none; width: 3rem; height: 3rem; border-radius: var(--control-radius); object-fit: cover; background: var(--accent-soft); }
.orphan-kind { display: grid; place-items: center; font-size: .72rem; color: var(--accent); }
.warning-text { font-weight: 600; }
.group-message-list li { padding: .5rem 0; border-top: 1px solid var(--line); }
.group-message-list li:first-child { border-top: 0; }
.group-message-list summary { cursor: pointer; }
.group-message-body { white-space: pre-wrap; margin: .5rem 0 0 1.2rem; overflow-wrap: anywhere; }

/* Admin: audit trail */
.audit-filter { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.audit-filter label { display: grid; gap: .2rem; }
.audit-list { list-style: none; margin: 0; padding: 0; }
.audit-row { display: grid; grid-template-columns: 9.5rem 1fr; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--line); border-left: 3px solid transparent; padding-left: .6rem; }
.audit-row:first-child { border-top: 0; }
.audit-row p { margin: 0; }
.audit-line { overflow-wrap: anywhere; }
.audit-signin { border-left-color: var(--muted); }
.audit-members { border-left-color: var(--accent); }
.audit-access { border-left-color: var(--warn, var(--accent)); }
@media (max-width: 700px) { .audit-row { grid-template-columns: 1fr; gap: .15rem; } }

/* Admin: system status */
.status-list { list-style: none; margin: 0; padding: 0; }
.status-row { display: flex; gap: .75rem; align-items: flex-start; padding: .55rem 0; border-top: 1px solid var(--line); }
.status-row:first-child { border-top: 0; }
.status-row p { margin: 0; }
.status-level { flex: none; min-width: 5.2rem; padding: .1rem .5rem; border-radius: 999px; border: 1px solid var(--line); text-align: center; font-size: .8rem; font-weight: 650; }
.status-ok .status-level { color: var(--ok, var(--accent)); border-color: currentColor; }
.status-warn .status-level { color: var(--warn, #9a6700); border-color: currentColor; }
.status-crit .status-level { color: var(--no, #b3261e); border-color: currentColor; background: color-mix(in srgb, currentColor 10%, transparent); }
.status-note { font-weight: 600; }
