:root { color-scheme: dark; --bg: #14161a; --fg: #e8e6e1; --muted: #a39f97; --accent: #8fb8de; --warn: #f0a58f;
  --side: #101215; --panel: #1c1f24; --line: #2b2f36; --raised: #252930; --ask: #e3b062; --ask-bg: #262118;
  --ok: #6cc59a; --off: #6b6f78; --mention: #26354a; --mention-fg: #b9d3f2; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--fg);
  font: 18px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
body.signin { display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
body.signin main { width: 100%; max-width: 24rem; text-align: center; }
h1 { font-size: 2.2rem; font-weight: 600; margin: 0 0 1.5rem; letter-spacing: .02em; }
body.signin button { font: inherit; font-weight: 600; width: 100%; min-height: 3.25rem; padding: .75rem 1.25rem;
  border: 0; border-radius: .75rem; background: var(--accent); color: #0d1620; cursor: pointer; }
button:disabled { opacity: .6; cursor: default; }
button:focus-visible, textarea:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
#status { min-height: 3em; margin: 1rem 0 0; color: var(--warn); }

/* ---- the app ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; }
/* --app-h is the height actually visible (set by app.js): phones do not always update 100dvh when the keyboard
   or the address bar comes and goes, which left the message box cut off below the screen. */
body.app { font-size: 16px; height: 100vh; height: 100dvh; height: var(--app-h, 100dvh); overflow: hidden; }
.app button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  text-align: left; }
.shell { display: grid; grid-template-columns: 17rem minmax(0, 1fr); height: 100%; }

.banner { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 5; margin: .5rem 0 0;
  padding: .4rem 1rem; border-radius: 1rem; background: var(--ask); color: #1a1408; font-weight: 600;
  font-size: .9rem; }

.side { background: var(--side); border-right: 1px solid var(--line); overflow-y: auto;
  padding: 1rem .75rem calc(1rem + env(safe-area-inset-bottom)); }
.side h2 { margin: 1.4rem .5rem .35rem; font-size: .75rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); }
.rows { list-style: none; margin: 0; padding: 0; }
.app .row { display: flex; align-items: center; gap: .55rem; width: 100%; min-height: 2.5rem;
  padding: .35rem .6rem; border-radius: .5rem; color: #c9c6bf; }
.app .row:hover { background: var(--panel); }
.app .row.on { background: var(--raised); color: #fff; }
.row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { flex: none; min-width: 1.4rem; padding: 0 .4rem; border-radius: .7rem; background: var(--ask);
  color: #1a1408; font-size: .8rem; font-weight: 700; line-height: 1.4rem; text-align: center; }
.app .needs-row { background: var(--ask-bg); border: 1px solid var(--ask); color: #f3dcb4; font-weight: 600;
  min-height: 2.9rem; }
.app .needs-row.quiet-needs { border-color: var(--line); background: var(--panel); color: #c9c6bf; }
.app .needs-row.on { box-shadow: 0 0 0 2px var(--ask) inset; }
.dot { flex: none; width: .6rem; height: .6rem; border-radius: 50%; }
.dot-on { background: var(--ok); }
.dot-off { background: var(--off); }
.dot-wait { box-shadow: 0 0 0 2px var(--side), 0 0 0 4px var(--ask); }
.archive-link { margin: 2rem .5rem 0; }
.signout { margin: .75rem .5rem 0; }
body.app.archive-body { height: auto; overflow: auto; }      /* a plain scrolling page */
.archive { max-width: 60rem; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.archive h1 { font-size: 1.3rem; } .archive h2 { font-size: 1.05rem; margin-top: 2rem; color: var(--fg); }
.archive pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--panel); border: 1px solid var(--line);
  border-radius: .5rem; padding: .9rem; font: .88rem/1.5 ui-monospace, Menlo, monospace; }
.archive-search { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin: 1rem 0; }
.archive-search input { flex: 1 1 14rem; min-width: 0; min-height: 2.6rem; padding: .45rem .7rem; border-radius: .5rem;
  border: 1px solid #4a4f58; background: var(--panel); color: var(--fg); font: inherit; }
.archive .notice { margin-left: 0; margin-right: 0; }
.archive pre { margin: .6rem 0; }
.archive mark { background: var(--ask); color: #1a1408; border-radius: .2rem; padding: 0 .1rem; }
.archive .entry { padding: .5rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; white-space: pre-wrap; }
.archive .meta { color: var(--muted); font-size: .85rem; }
.app .quiet { color: var(--muted); font-size: .9rem; text-decoration: underline; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.head { display: flex; align-items: center; gap: .75rem; padding: .75rem 1.25rem;
  padding-top: calc(.75rem + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); }
.head-text { min-width: 0; flex: 1; }
.head-actions { flex: none; margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.goal-form { margin: .75rem 1.25rem 0; padding: .75rem; border-radius: .5rem; background: var(--raised); }
.goal-form label { display: block; font-weight: 600; margin-bottom: .4rem; }
.goal-form input { width: 100%; box-sizing: border-box; min-height: 2.6rem; padding: .45rem .7rem; border-radius: .5rem;
  border: 1px solid #4a4f58; background: var(--panel); color: var(--fg); font: inherit; }
.board { margin: .75rem 1.25rem 0; border: 1px solid var(--line); border-radius: .5rem; background: var(--raised);
  max-height: 45vh; overflow-y: auto; overscroll-behavior: contain; }
.board summary { padding: .55rem .75rem; font-weight: 600; cursor: pointer; min-height: 1.6rem; }
.board-body { padding: 0 .75rem .6rem; }
.board-part { margin: .5rem 0 .25rem; color: var(--muted); font-size: .78rem; font-weight: 650; letter-spacing: .06em;
  text-transform: uppercase; }
.board-part.needs { color: var(--ask); }
.board-item { padding: .45rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.board-title { font-weight: 600; }
.board-text { white-space: pre-wrap; margin-top: .15rem; }
.board-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; margin-top: .25rem;
  color: var(--muted); font-size: .85rem; }
.card.board-card .board-title { margin-top: .2rem; font-size: 1.02rem; }
.goal-hint { margin: .4rem 0 0; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.head h1 { margin: 0; font-size: 1.15rem; font-weight: 650; letter-spacing: 0; overflow-wrap: anywhere; }
.subtitle { margin: 0; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.app .back { display: none; flex: none; padding: .4rem .7rem; border-radius: .5rem; background: var(--panel);
  color: var(--accent); font-weight: 600; }
.push-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: .75rem 1.25rem 0; }
.app .push-btn { min-height: 2.6rem; padding: .45rem 1rem; border-radius: .5rem; background: var(--accent);
  color: #0d1620; font-weight: 650; }
.push-status { margin: 0; color: var(--muted); font-size: .92rem; }
.notice { margin: .75rem 1.25rem 0; padding: .5rem .75rem; border-radius: .5rem; background: var(--raised);
  color: var(--fg); }

.feed { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem 1.25rem; display: flex; flex-direction: column;
  gap: 1rem; overscroll-behavior: contain; }
.feed > :first-child { margin-top: auto; }
.feed.feed-top > :first-child { margin-top: 0; }      /* "Needs you": cards start at the top */
.empty { color: var(--muted); margin: auto 0; text-align: center; }
.msg { max-width: 48rem; min-width: 0; }
.meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; margin-bottom: .1rem; }
.sender { font-weight: 650; color: #fff; overflow-wrap: anywhere; }
.msg.mine .sender { color: var(--accent); }
.when { color: var(--muted); font-size: .8rem; }
.kind { color: var(--muted); font-size: .8rem; font-style: italic; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; line-height: 1.5; }
.mention { background: var(--mention); color: var(--mention-fg); border-radius: .25rem; padding: 0 .2rem; }
.mention.me { background: var(--ask-bg); color: var(--ask); font-weight: 600; }
.note { margin-top: .45rem; padding: .3rem 0 .3rem .7rem; border-left: 3px solid var(--off); color: var(--muted);
  font-size: .9rem; overflow-wrap: anywhere; }
.note .choice { margin-left: .25rem; }

.card { min-width: 0; max-width: 48rem; padding: .8rem 1rem; border-radius: .7rem; border: 1px solid var(--line);
  background: var(--panel); }
.card.question { border-color: var(--ask); background: var(--ask-bg); }
.card .tag { color: var(--ask); font-size: .75rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; overflow-wrap: anywhere; margin-bottom: .3rem; }
.card.alert .tag { color: #dcd8d0; }
.card + .meta, .card .meta { margin-top: .35rem; }
.choices { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.app .choice { min-height: 2.6rem; padding: .45rem .9rem; border-radius: .5rem; border: 1px solid #4a4f58;
  background: var(--raised); color: #fff; overflow-wrap: anywhere; max-width: 100%; }
.app .choice.primary { background: var(--ask); border-color: var(--ask); color: #1a1408; font-weight: 650; }
.app .choice:hover:not(:disabled) { filter: brightness(1.12); }
.app .linkish { margin-top: .6rem; color: var(--accent); text-decoration: underline; font-size: .9rem; }
.own-answer { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.own-answer textarea { flex: 1 1 14rem; }
.answer { margin-top: .6rem; padding-top: .5rem; border-top: 1px solid #4a3f2c; white-space: pre-wrap;
  overflow-wrap: anywhere; }
.answer-label { color: var(--ask); font-weight: 600; }
.card-error, .post-error { color: var(--warn); margin: .5rem 0 0; font-size: .92rem; }

.composer { display: flex; flex-wrap: wrap; gap: .5rem; padding: .75rem 1.25rem;
  padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.app textarea { font: inherit; color: var(--fg); background: var(--panel); border: 1px solid #3a3f48;
  border-radius: .6rem; padding: .6rem .75rem; resize: none; min-width: 0; field-sizing: content;
  min-height: 2.9rem; max-height: 12rem; overflow-wrap: anywhere; }
.composer textarea { flex: 1 1 auto; width: 0; }
.mentions { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: .4rem; }
.app .mentions button { min-height: 2.4rem; padding: .3rem .75rem; border-radius: 99px; border: 1px solid #3a3f48;
  background: var(--panel); color: var(--accent); font-weight: 600; }
.app .mentions button.first { border-color: var(--accent); }
.app #send { flex: none; min-height: 2.9rem; padding: 0 1.2rem; border-radius: .6rem; background: var(--accent);
  color: #0d1620; font-weight: 650; }
.post-error { flex-basis: 100%; }
.app .attach { flex: none; min-height: 2.9rem; padding: 0 .7rem; border-radius: .6rem; border: 1px solid #3a3f48;
  background: var(--panel); color: var(--accent); font-weight: 600; }
.attached { flex-basis: 100%; display: flex; align-items: baseline; gap: .75rem; margin: 0; min-width: 0;
  color: var(--muted); font-size: .92rem; }
.attached-name { min-width: 0; overflow-wrap: anywhere; }
.app .attached .linkish { margin-top: 0; flex: none; }
.file-chip { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .75rem; margin-top: .35rem;
  padding: .45rem .7rem; max-width: 100%; width: fit-content; border: 1px solid var(--line); border-radius: .5rem;
  background: var(--panel); }
.file-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.file-size { color: var(--muted); font-size: .85rem; }
.file-gone { color: var(--muted); font-size: .85rem; font-style: italic; }
.file-chip a { color: var(--accent); font-weight: 600; }

@media (max-width: 699px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  body.show-list .main { display: none; }
  body.show-main .side { display: none; }
  .side { border-right: 0; padding-top: calc(1rem + env(safe-area-inset-top)); }
  .app .row { min-height: 3rem; font-size: 1.05rem; }
  .app .back { display: block; }
  .head { padding-left: .75rem; padding-right: .75rem; }
  .feed { padding: .9rem .9rem; }
  .push-bar { margin-left: .75rem; margin-right: .75rem; }
  .composer { padding-left: .75rem; padding-right: .75rem; }
  .head { flex-wrap: wrap; }
  .head-actions { flex-basis: 100%; justify-content: flex-start; }      /* own row under the title */
  .goal-form { margin-left: .75rem; margin-right: .75rem; }
  .board { margin-left: .75rem; margin-right: .75rem; }
}

/* profile cards */
[data-agent]:not(button) { cursor: help; text-decoration: underline dotted; text-decoration-color: var(--line); text-underline-offset: .2em; }
.profile { position: fixed; z-index: 20; width: min(21rem, calc(100vw - 16px)); }
.profile-card { background: var(--raised); border: 1px solid var(--line); border-radius: .6rem; padding: .7rem .85rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45); font-size: .92rem; }
.profile-top { display: flex; align-items: center; gap: .5rem; }
.profile-name { font-weight: 650; color: #fff; }
.profile-status { margin-left: auto; color: var(--muted); font-size: .85rem; }
.profile-facts { display: grid; grid-template-columns: auto 1fr; gap: .15rem .75rem; margin: .55rem 0 0; }
.profile-facts dt { color: var(--muted); }
.profile-facts dd { margin: 0; overflow-wrap: anywhere; }
.profile-about { margin: .55rem 0 0; padding-top: .55rem; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
