/*
 * base.css — page defaults and reusable pieces (buttons, inputs, tags).
 *
 * Naming: classes follow a light BEM style.
 *   .block            → a component           (.button)
 *   .block__element   → a part of it          (.module-frame__header)
 *   .block--modifier  → a variation           (.button--primary)
 *   .is-state         → a temporary state     (.is-active, .is-dragging)
 */

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

/*
 * 3den is designed light. Saying so keeps browsers in dark mode (or a
 * host page) from switching built-in colors on buttons, menus and form
 * controls, which could leave menu text the same color as its background.
 */
:root {
  color-scheme: light;
}

/* `hidden` always wins, even over a class that sets `display`. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--color-page);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--font-size-body);
  line-height: var(--line-height);
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: normal;
  line-height: 1.3;
}

p {
  margin: 0;
}

a {
  color: var(--color-link);
  text-decoration: none;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

/* Hidden on screen but still read by screen readers. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ─── Buttons ──────────────────────────────────────────────────────────── */

.button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface-muted);
  color: var(--color-text);
  font-weight: bold;
  cursor: pointer;
}

.button:hover {
  background: var(--color-surface);
  border-color: var(--color-text-faint);
}

.button--primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-on-accent);
}

.button--primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.button--quiet {
  background: transparent;
  border-color: transparent;
  font-weight: normal;
  color: var(--color-text-muted);
}

.button--danger {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #ffffff;
}

/* Links styled as buttons keep their button colors on hover; otherwise a:hover
   turns the text link-blue, which vanishes on a blue button (and on phones a
   tap leaves the hover on). */
a.button:hover {
  color: var(--color-text);
  text-decoration: none;
}

a.button--primary:hover {
  color: var(--color-on-accent);
}

a.button--danger:hover {
  color: #ffffff;
}

.button--small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.icon-button--subtle {
  width: 24px;
  height: 24px;
  color: var(--color-text-faint);
}

/* Arrow buttons at the first/last position: still clickable, just dimmed. */
.icon-button[data-at-edge='true'] {
  opacity: 0.35;
}

/* A button that looks like a link (for small actions like "Pin"). */
.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-link);
  font-size: var(--font-size-small);
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.link-button--danger {
  color: var(--color-danger);
}

/* ─── Form fields ──────────────────────────────────────────────────────── */

.input {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
}

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

textarea.input {
  resize: vertical;
}

.input--compact {
  width: auto;
  flex: 1 1 120px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.form-row--end {
  justify-content: flex-end;
}

.form-error {
  color: var(--color-danger);
  font-size: var(--font-size-small);
  min-height: 0;
}

.form-error:empty {
  display: none;
}

/* ─── Small pieces ─────────────────────────────────────────────────────── */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0 6px;
  border: 1px solid var(--color-accent-border);
  background: var(--color-accent-soft);
  color: var(--color-accent-hover);
  font-size: 11px;
  font-weight: bold;
}

.avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #ffffff;
  font-weight: bold;
  line-height: 1;
}

.avatar--photo {
  background-position: center;
  background-size: cover;
}

.avatar--empty {
  border: 1px dashed var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text-faint);
}

.progress-bar {
  display: block;
  height: 6px;
  background: var(--color-border-faint);
  overflow: hidden;
}

.progress-bar__fill {
  display: block;
  height: 100%;
  background: var(--color-accent);
  transition: width 0.2s ease;
}

/* Overlapping avatars (js/ui/avatar.js → avatarStack) */
.avatar-stack {
  display: inline-flex;
  align-items: center;
}

.avatar-stack .avatar {
  box-shadow: 0 0 0 2px var(--color-surface);
}

.avatar-stack .avatar + .avatar {
  margin-left: -7px;
}

.avatar--more {
  background: var(--color-border-faint);
  color: var(--color-text-muted);
}

/* ─── Member picker (js/ui/member-picker.js) ───────────────────────────── */

.member-picker {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 2px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  cursor: pointer;
}

.member-picker:hover,
.member-picker[aria-expanded='true'] {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

/* The checklist floats above everything, attached to <body>. */
.member-popover {
  position: fixed;
  z-index: 150;
  padding: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-raised);
}

.member-popover__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  color: var(--color-text);
  cursor: pointer;
}

.member-popover__option:hover {
  background: var(--color-accent-soft);
}

.member-popover__option input {
  accent-color: var(--color-accent);
}

.member-popover__name {
  flex: 1;
}

.member-popover__clear {
  display: block;
  margin: 4px 8px 4px auto;
}

/* "Assign (?)" label + picker inside add-task forms */
.form-picker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

/* A row of toggle buttons where one is active (e.g. All / Mine / Open). */
.segmented {
  display: inline-flex;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.segmented__option {
  padding: 2px 10px;
  border: 0;
  border-left: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  font-size: var(--font-size-small);
  cursor: pointer;
}

.segmented__option:first-child {
  border-left: 0;
}

.segmented__option.is-active {
  background: var(--color-accent-soft);
  color: var(--color-accent-hover);
  font-weight: bold;
}

/* ─── Toasts (js/ui/toast.js) ──────────────────────────────────────────── */

.toast-region {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.toast {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: var(--color-text);
  color: var(--color-surface); /* the reverse of the page: dark on light themes, light on dark ones */
  border-radius: var(--radius);
  box-shadow: var(--shadow-raised);
}

.toast__action {
  border: 0;
  background: none;
  color: #9fc3ff;
  font-weight: bold;
  cursor: pointer;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* An @mention, in text and in documents (js/ui/mentions.js). */
.mention {
  padding: 0 2px;
  border-radius: 3px;
  background: var(--color-accent-soft);
  color: var(--color-link);
  white-space: nowrap;
}

/* The list that pops up while typing "@" (js/ui/mention-picker.js). */
.mention-picker {
  position: fixed;
  z-index: 1100;
  width: 260px;
  margin: 0;
  padding: 4px 0;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-raised);
  list-style: none;
}

.mention-picker__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  font-size: var(--font-size-small);
  cursor: pointer;
}

.mention-picker__option.is-active {
  background: var(--color-accent-soft);
}

.mention-picker__name {
  flex: 1 1 auto;
}

.mention-picker__username {
  color: var(--color-text-muted);
}

/* "● 2 online" (js/state/presence.js) */
.online-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2e9c5a;
  vertical-align: 1px;
}

.online-count {
  margin-left: 4px;
  white-space: pre;
  cursor: help;
}

/*
 * ─── Menus: always readable ──────────────────────────────────────────────
 *
 * Every drop-down item keeps dark text on a pale highlight when hovered or
 * focused, whatever the browser, theme or link colors around it would do.
 * The plain color comes first, so browsers that don't understand
 * color-mix() (used by group colors) still get a visible highlight.
 */
.groups-menu__item,
.groups-menu__create,
.account-menu__item,
.attach-menu__item,
.vault__menu-item,
.notifications-menu__item,
.member-popover__option,
.mention-picker__option,
.app-search__result {
  color: var(--color-text);
}

.groups-menu__item:hover,
.groups-menu__item:focus-visible,
.groups-menu__create:hover,
.groups-menu__create:focus-visible,
.account-menu__item:hover,
.account-menu__item:focus-visible,
.attach-menu__item:hover,
.attach-menu__item:focus-visible,
.vault__menu-item:hover,
.vault__menu-item:focus-visible,
.member-popover__option:hover,
.mention-picker__option.is-active,
.app-search__result:hover,
.app-search__result.is-active {
  background: #eaf3ff;
  background: var(--color-accent-soft, #eaf3ff);
  color: var(--color-text);
  text-decoration: none;
  opacity: 1;
  visibility: visible;
}

/* Links inside menu items keep their own color on hover. */
.groups-menu__create:hover,
.account-menu__item:hover {
  color: var(--color-link);
}

.account-menu__sign-out,
.account-menu__sign-out:hover {
  color: var(--color-danger);
}

/* Native drop-downs (<select>): plain light options. */
select option {
  background: #ffffff;
  color: #202122;
}

/* ─── Empty states: a friendly first-use screen with one thing to do ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 16px;
  color: var(--color-text-muted);
  text-align: center;
}
.empty-state p { margin: 0; max-width: 42ch; }
.empty-state__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface));
  color: var(--color-accent);
}
.empty-state__title { color: var(--color-text); font-weight: bold; }
.empty-state .button { margin-top: 8px; }
.empty-state--compact { padding: 14px 8px; gap: 4px; }
.empty-state--compact .empty-state__icon { width: 38px; height: 38px; }

/* Organizer demo (demo-tour.js) */
.tour-card { position: fixed; right: 20px; bottom: 20px; z-index: 900; width: min(360px, calc(100vw - 24px)); padding: 14px 16px; background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border-strong); border-radius: 12px; box-shadow: var(--shadow-raised); animation: tour-in .25s ease; }
.tour-card__top { display: flex; align-items: center; justify-content: space-between; color: var(--color-text-muted); font-size: var(--font-size-small); }
.tour-card__title { display: block; margin-top: 4px; font-size: var(--font-size-large); }
.tour-card__text { margin: 6px 0 12px; }
.tour-card__actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.tour-card__actions .link-button { margin-right: auto; }
.tour-spot { outline: 3px solid var(--color-accent) !important; outline-offset: 4px; border-radius: 6px; animation: tour-pulse 1.6s ease-in-out 2; }
@keyframes tour-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes tour-pulse { 50% { outline-offset: 9px; } }
@media (max-width: 640px) { .tour-card { right: 12px; left: 12px; width: auto; bottom: calc(var(--tab-bar-height, 0px) + var(--safe-bottom, 0px) + 12px); } }
@media (prefers-reduced-motion: reduce) { .tour-card, .tour-spot { animation: none; } }

/* ─── Motion (item 44): small, quick, and off for people who ask for less ──
 * Pages fade up a little when you open them; buttons give under a press;
 * cards lift on hover; checkmarks pop. Nothing takes longer than 250 ms. */
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { 40% { transform: scale(1.18); } }
#settings-view:not([hidden]), #module-page-view:not([hidden]), #messages-view:not([hidden]) { animation: view-in .2s ease-out; }
.button, .icon-button, .chip, .rsvp__button { transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .08s ease, box-shadow .15s ease; }
.button:active:not(:disabled), .rsvp__button:active:not(:disabled), .chip:active { transform: translateY(1px) scale(.98); }
.feed-page article, .directory__card, .help__topic, .landing__pillar, .tag-page__item { transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease; }
.feed-page article:hover, .help__topic:hover, .landing__pillar:hover { box-shadow: var(--shadow-raised); }
.rsvp__button.is-mine .rsvp__emoji, .welcome-list__item.is-done .welcome-list__mark, .shifts__row.is-mine .shifts__count { animation: pop .25s ease-out; }
.toast { animation: view-in .2s ease-out; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* The "+" button and its sheet (js/editor/quick-create.js) */
.quick-create__button { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 999px; background: var(--color-accent); color: var(--color-on-accent); cursor: pointer; flex: none; }
.quick-create__button:hover { filter: brightness(1.08); }
.quick-create__button--float { display: none; }
@media (max-width: 640px) {
  .app-bar__new { display: none; }
  .quick-create__button--float { display: grid; position: absolute; right: 16px; top: -58px; /* 6px above the bottom bar */ width: 52px; height: 52px; box-shadow: var(--shadow-raised); }
}
.quick-create__panel { width: min(560px, calc(100vw - 24px)); }
.quick-create__tabs { margin-bottom: 12px; }
.quick-create__form { display: grid; gap: 10px; }
.quick-create__foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.quick-create__foot .quick-create__where { margin-right: auto; }
.quick-create__where { display: inline-flex; align-items: center; gap: 6px; font-size: var(--font-size-small); color: var(--color-text-muted); }
.quick-create__where select { max-width: 260px; }
.quick-create__row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.quick-create__reading { margin: 0; }

/* ─── Edit in place ─────────────────────────────────────────────────────
   A title, date, or name that people who can edit may tap to change. */
.in-place {
  cursor: text;
  border-radius: 6px;
  outline-offset: 2px;
  transition: background-color 0.12s;
}

.in-place:not(.is-editing):hover {
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-accent) 8%, transparent);
}

.in-place__group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}

.in-place__input {
  font: inherit;
  min-width: 0;
  max-width: 100%;
  padding: 2px 8px;
}

.in-place__input--date,
.in-place__input--time {
  font-size: var(--font-size-body);
}

/* While editing or previewing a page, the floating + is out of the way. */
body.is-editing-page .quick-create__button--float { display: none; }

/* ─── Ctrl+K: jump anywhere (js/editor/jump.js) ─────────────────────────── */
.jump-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 12px 12px;
  background: rgb(0 0 0 / 0.32);
}

.jump {
  display: flex;
  flex-direction: column;
  width: min(600px, 100%);
  max-height: 70vh;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.28);
}

.jump__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.jump__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 17px;
  outline: none;
}

.jump__kbd,
.jump__foot {
  font-size: 12px;
  color: var(--color-text-muted);
}

.jump__kbd {
  padding: 1px 6px;
  border: 1px solid var(--color-border);
  border-radius: 5px;
}

.jump__results {
  flex: 1;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}

.jump__result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.jump__result.is-active { background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.jump__icon { display: inline-flex; color: var(--color-accent); }
.jump__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jump__detail { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--color-text-muted); }
.jump__empty { padding: 14px 10px; color: var(--color-text-muted); }
.jump__foot { margin: 0; padding: 8px 14px; border-top: 1px solid var(--color-border); }

@media (max-width: 640px) { .jump__foot { display: none; } }

/* ─── One next step for newcomers (js/onboarding/next-step.js) ─────────── */
.next-step {
  margin: 10px 0;
  padding: 9px 10px 9px 14px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 30%, var(--color-border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--color-accent) 6%, var(--color-surface));
}

.next-step__line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.next-step__arrow { display: inline-flex; flex: none; color: var(--color-accent); transform: rotate(180deg); }
.next-step__label { flex: 1; min-width: 0; }
.next-step__go { flex: none; }
.next-step__count { flex: none; font-size: 13px; color: var(--color-text-muted); white-space: nowrap; }
.next-step__hide { flex: none; }
.next-step form { display: flex; gap: 8px; margin: 8px 0 0 24px; }
.next-step form .input { flex: 1; min-width: 0; }

@media (max-width: 640px) {
  .next-step__line { flex-wrap: wrap; }
  .next-step__label { flex-basis: calc(100% - 60px); }
  .next-step form { margin-left: 0; }
}

/* ─── "Who sees this" (js/ui/audience-chip.js) ─────────────────────────── */
.audience-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.audience-chip:hover { border-color: var(--color-accent); color: var(--color-text); }
.audience-chip svg { flex: none; }
.audience-chip.is-fixed { border-style: dashed; }
.quick-create__audience { display: inline-flex; }

/* The + (quick-create.js) belongs to the Feed; other pages have their own Create buttons. */
body:not([data-page="feed"]) .quick-create__button { display: none !important; }

/* Several people in one notification line (groupNotifications in notification-bell.js) */
.notifications-menu__faces { display: inline-flex; flex: none; }
.notifications-menu__faces .avatar + .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--color-surface); }

/* Keyboard shortcuts (js/editor/shortcuts.js) */
.shortcuts-backdrop { position: fixed; inset: 0; z-index: 220; display: grid; place-items: center; padding: 16px; background: rgb(0 0 0 / 0.35); }
.shortcuts { width: min(760px, 100%); max-height: 86vh; overflow-y: auto; padding: 18px 22px 22px; border-radius: 14px; background: var(--color-surface); box-shadow: 0 20px 60px rgb(0 0 0 / 0.28); }
.shortcuts__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.shortcuts__title { margin: 0; font-size: 20px; }
.shortcuts__groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 6px 28px; }
.shortcuts__group-title { margin: 12px 0 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.shortcuts__list { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; font-size: 14px; }
.shortcuts__list dt { white-space: nowrap; }
.shortcuts__list dd { margin: 0; color: var(--color-text-muted); }
.shortcuts kbd { display: inline-block; min-width: 20px; padding: 0 6px; border: 1px solid var(--color-border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--color-surface-muted); font: 12px/20px var(--font-sans, system-ui); text-align: center; }

/* The welcome splash a new account sees once (js/onboarding/welcome-splash.js): the page's own background, an apple tree, two seconds. */
.welcome-splash {
  --splash-trunk: #8d6e63;
  --splash-leaves: #6aa84f;
  --splash-apple: #d64541;
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--color-page);
  opacity: 1;
  transition: opacity 0.6s ease;
  cursor: default;
}
.welcome-splash.is-leaving { opacity: 0; pointer-events: none; }
.welcome-splash__tree { width: 160px; height: 160px; }
.welcome-splash__text { margin: 0; font-size: 24px; color: var(--color-text); }

/* A pop-up over the page (js/ui/modal.js): what's behind dims, the box takes the center. */
.modal {
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: auto;
}
.modal::backdrop { background: rgba(15, 20, 30, 0.55); }
.modal__box { padding: 16px; }
html.has-modal { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .modal[open] { animation: modal-in 160ms ease-out; }
  @keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
}
@media (max-width: 640px) {
  .modal { width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: calc(100dvh - 32px); }
}
.feed-module__new-post { margin-left: auto; white-space: nowrap; }
.module-frame__header .feed-module__new-post + .module-frame__open { margin-left: 4px; }
/* The post composer as a pop-up: no box inside the box, a roomier text area. */
.feed-compose-modal .modal__box { padding: 18px 20px 20px; }
.feed-compose-modal .feed-composer { border: 0; background: none; padding: 0; box-shadow: none; }
.feed-compose-modal .feed-composer__top strong { font-size: 18px; }
.feed-compose-modal textarea:not(.feed-composer__text) { min-height: 140px; }
/* A blog's About while editing (space-header.js aboutInPlace). */
.blog-about-edit { cursor: text; border-radius: 6px; margin: 4px -6px 0; padding: 2px 6px; }
.blog-about-edit:hover, .blog-about-edit:focus-visible { background: var(--surface-muted, rgba(0,0,0,.05)); outline: 1px dashed var(--border, #c9ced6); }
.blog-about-edit.is-empty { color: var(--muted, #6b7280); font-style: italic; }
.blog-about-edit__input { display: block; width: min(560px, 100%); margin-top: 6px; resize: vertical; font: inherit; }

/* An item opened over the page from a module (js/ui/item-overlay.js). */
.item-overlay-modal .modal__box { width: min(520px, 100%); }
.item-overlay { display: flex; flex-direction: column; gap: 14px; }
.item-overlay__top { display: flex; align-items: center; gap: 10px; }
.item-overlay__check { width: 20px; height: 20px; flex: none; }
.item-overlay__title-input { flex: 1; min-width: 0; font: inherit; font-size: 20px; font-weight: 700; color: var(--color-text); border: 1px solid transparent; border-radius: 6px; background: none; padding: 2px 6px; }
.item-overlay__title-input:hover { border-color: var(--color-border); }
.item-overlay__title-input:focus { outline: none; border-color: var(--color-accent); }
.item-overlay__title { flex: 1; margin: 0; font-size: 20px; }
.item-overlay__fields { display: flex; flex-direction: column; gap: 10px; }
.item-overlay__field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: var(--font-size-small); }
.item-overlay__field > span:first-child { width: 72px; flex: none; color: var(--color-text-muted); }
.item-overlay__field .is-overdue { color: var(--color-danger); font-weight: 700; }
.item-overlay__muted { margin: -4px 0 0 82px; font-size: var(--font-size-small); color: var(--color-text-muted); }
.item-overlay__notes textarea { width: 100%; resize: vertical; box-sizing: border-box; }
.item-overlay__subhead { margin: 0 0 6px; font-size: var(--font-size-small); color: var(--color-text-muted); }
.item-overlay__sublist { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.item-overlay__sublist li { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.item-overlay__add { display: flex; gap: 6px; }
.item-overlay__add .input { flex: 1; min-width: 0; }
.item-overlay__footer { display: flex; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--color-border-faint); }
.item-overlay--event .event-details { border: 0; padding: 0; box-shadow: none; }
.todo-item__label--button { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.todo-item__label--button:hover { color: var(--color-link); text-decoration: underline; }

/* Task, list item, and event pop-ups (item-overlay.js) hang from near the top instead of sitting centered,
   so when their content changes height (an RSVP, a new subtask) nothing above it moves. */
.modal.item-overlay-modal {
  margin-top: max(24px, 8vh);
  margin-bottom: auto;
}

/* ─── "…" menus (js/ui/more-menu.js) ─────────────────────────────────────── */

.more-menu {
  z-index: 150;
  min-width: 170px;
  padding: 4px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: var(--shadow-lg, 0 10px 30px rgba(0, 0, 0, 0.16));
}
.more-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.more-menu__item:hover,
.more-menu__item:focus-visible { background: var(--color-surface-muted); outline: none; }
.more-menu__item.is-danger { color: var(--color-danger, #c0392b); }
/* The onboarding tutorial (js/onboarding/tutorial.js): the kicker, choice cards (P1, N1, E2, R1), and an outline that stays put */
.onboarding-tour__kicker { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-accent); }
.onboarding-tour__choices { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.onboarding-tour__choices .button { justify-content: flex-start; width: 100%; }
/* While a card is up, the page can scroll everything clear of it (a form's button under the card, on a phone). */
body.has-tour-card { padding-bottom: calc(var(--tour-card-space, 0px) + 24px); }
.tour-spot--steady { animation: tour-pulse 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .tour-spot--steady { animation: none; } }

/* ─── Set up your group's page (js/groups/group-setup.js) ─── */
.group-setup-modal { width: min(720px, 96vw); }
.group-setup { display: flex; flex-direction: column; gap: 8px; }
.group-setup__title { margin: 0; font-size: 24px; }
.group-setup__sub { margin: 0; color: var(--color-text-muted); }
.group-setup__ask { margin: 8px 0 0; font-weight: 600; font-size: 17px; }
.group-setup__hint { margin: 0; color: var(--color-text-muted); font-size: var(--font-size-small); }
.group-setup__choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: min(56vh, 520px); overflow-y: auto; padding: 4px 2px; }
.group-setup__choice {
  position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px 10px 38px;
  border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-surface);
  color: var(--color-text); font: inherit; text-align: left; cursor: pointer;
}
.group-setup__choice:hover { border-color: var(--color-border-strong); }
.group-setup__choice.is-picked { border-color: var(--color-accent); background: var(--color-accent-soft); }
.group-setup__check {
  position: absolute; left: 12px; top: 12px; width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid var(--color-border-strong); display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
.group-setup__choice.is-picked .group-setup__check { background: var(--color-accent); border-color: var(--color-accent); }
.group-setup__icon { color: var(--color-text-muted); margin-top: 1px; }
.group-setup__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.group-setup__text span { font-size: var(--font-size-small); color: var(--color-text-muted); }
.group-setup__actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.group-setup__count { color: var(--color-text-muted); font-size: var(--font-size-small); }
