/* Messages (features/inbox.js): the top bar's Messages button, the conversation list, one conversation, phone alerts. */

/* Installed on a phone's Home Screen the page can reach the screen's edges (viewport-fit=cover): keep clear of them. */
.topbar { padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }

/* top bar: Messages, left of the account circle. 44px tap area. */
.account { display: flex; align-items: center; gap: .35rem; }
.inbox-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--ink); }
.inbox-btn[hidden] { display: none; }
.inbox-btn:hover { background: var(--fill); text-decoration: none; }
.inbox-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.inbox-btn[aria-current] { color: var(--tint); }
.inbox-n { position: absolute; top: 5px; inset-inline-end: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--berry); color: var(--berry-ink); font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.inbox-n[hidden] { display: none; }

/* the list */
.ib-card { padding: 0; overflow: hidden; }
.ib-list { list-style: none; margin: 0; padding: 0; }
.ib-list > li + li { border-top: .5px solid var(--sep); }
.ib-link { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1.1rem .8rem .7rem; color: var(--ink); min-height: 56px; }
.ib-link:hover { background: var(--fill); text-decoration: none; }
.ib-link:focus-visible { outline: 2px solid var(--tint); outline-offset: -2px; }
.ib-dot { flex: none; width: 9px; height: 9px; margin-top: .45rem; border-radius: 50%; }
.ib-row.unread .ib-dot { background: var(--tint); }
.ib-main { flex: 1; min-width: 0; display: grid; gap: .1rem; }
.ib-top { display: flex; gap: .5rem; align-items: baseline; }
.ib-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ib-when { flex: none; color: var(--muted); font-size: .85rem; }
.ib-subject { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-preview { color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.ib-row.unread .ib-preview { color: var(--ink); }
.ib-empty { padding: 1rem 1.25rem; margin: 0; }
.ib-prompt { margin-bottom: 1rem; display: grid; gap: .5rem; }
.ib-prompt p { margin: 0; }
.ib-prompt .actions { margin: 0; }
.ib-home { padding: 0; overflow: hidden; }
.ib-home .mg-row { padding: .75rem 1.25rem; }
.ib-home .mg-title { font-weight: 600; color: var(--tint); }

/* one conversation */
.ib-thread { display: grid; gap: .75rem; margin: 1rem 0; }
.ib-msg { display: grid; justify-items: start; gap: .2rem; max-width: min(34rem, 88%); }
.ib-msg.mine { justify-self: end; justify-items: end; }
.ib-from { font-size: .8rem; font-weight: 600; color: var(--muted); padding: 0 .4rem; }
.ib-bubble { background: var(--surface); box-shadow: 0 0 0 .5px var(--card-edge); border-radius: 18px 18px 18px 6px; padding: .55rem .9rem; overflow-wrap: anywhere; }
.ib-msg.mine .ib-bubble { background: var(--tint); color: var(--tint-ink); box-shadow: none; border-radius: 18px 18px 6px 18px; }
.ib-bubble p { margin: 0; }
.ib-bubble p + p { margin-top: .5rem; }
.ib-time { font-size: .75rem; color: var(--muted); padding: 0 .4rem; }
.ib-check { max-width: 36rem; }
.ib-check h2 { margin: 0; font-size: 1.15rem; }
/* A plot check's result tints the whole card (was a side stripe; audit 2026-11-10) */
.ib-check.work { background: color-mix(in srgb, var(--amber-soft) 70%, var(--surface)); }
.ib-check.ok { background: color-mix(in srgb, var(--tint-soft) 70%, var(--surface)); }
.ib-h { font-size: .9rem; margin: 0 0 .2rem; color: var(--muted); font-weight: 600; }
.ib-items { margin: 0; padding-inline-start: 1.2rem; }
.ib-photos { display: flex; flex-wrap: wrap; gap: .5rem; }
.ib-photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; display: block; }
.ib-reply { position: sticky; bottom: .75rem; z-index: 4; display: grid; gap: .5rem; }
.ib-reply textarea { width: 100%; resize: vertical; min-height: 4.5rem; }
.ib-reply .actions { margin: 0; justify-content: flex-end; }
@media (max-width: 720px) { .ib-reply { bottom: calc(64px + max(6px, env(safe-area-inset-bottom))); } }

/* a new conversation */
.ib-new { max-width: 40rem; }
.ib-to { border: 0; margin: 0; padding: 0; display: grid; gap: .4rem; }
.ib-to legend { font-weight: 600; margin-bottom: .3rem; padding: 0; }
.ib-choice { display: flex; gap: .65rem; align-items: flex-start; padding: .65rem .8rem; border-radius: var(--r-ctl); background: var(--fill); cursor: pointer; min-height: 44px; }
.ib-choice:has(input:checked) { box-shadow: inset 0 0 0 2px var(--tint); background: var(--tint-soft); }
.ib-choice input { margin-top: .2rem; }
.ib-choice > span { display: grid; gap: .1rem; }
.ib-choice-title { font-weight: 600; }
.ib-choice .help { margin: 0; }
.ib-person[hidden] { display: none; }

/* phone alerts: Add to Home Screen steps */
.ib-steps { margin: .25rem 0 0; padding-inline-start: 1.3rem; display: grid; gap: .45rem; }
.ib-share { width: 1.15em; height: 1.15em; vertical-align: -.2em; fill: none; stroke: var(--tint); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.inbox-btn[aria-current] { color: var(--tint); background: var(--tint-soft); }

/* Who to write to: chips for the chosen people, then the box; suggestions underneath (name or plot number) */
.ib-person { position: relative; }
.rcp { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; min-height: 48px; padding: .3rem .5rem;
  border: 1px solid var(--field-edge); border-radius: var(--r-ctl); background: var(--fill); cursor: text; }
.rcp:focus-within { outline: 3px solid var(--tint-soft); border-color: var(--tint); }
.rcp-chips { display: contents; list-style: none; margin: 0; padding: 0; }
.rcp-chip { display: inline-flex; align-items: center; gap: .15rem; padding: .2rem .2rem .2rem .65rem; border-radius: 999px;
  background: var(--tint-soft); color: var(--ink); font-size: .95rem; font-weight: 500; }
.rcp-chip button { border: 0; background: none; color: inherit; font-size: 1.15rem; line-height: 1; min-width: 32px; min-height: 32px; cursor: pointer; }
.rcp input { flex: 1 1 8rem; border: 0 !important; background: transparent !important; outline: none; box-shadow: none !important;
  min-height: 40px; padding: 0 .25rem; }
.rcp-list { list-style: none; margin: .25rem 0 0; padding: .25rem 0; border: 1px solid var(--sep); border-radius: var(--r-ctl);
  background: var(--surface); box-shadow: 0 8px 24px rgb(0 0 0 / .12); position: absolute; inset-inline-start: 0; inset-inline-end: 0; z-index: 20; }
.rcp-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .85rem; min-height: 44px; align-items: center; cursor: pointer; }
.rcp-list li[aria-selected="true"] { background: var(--fill); }
.rcp-meta { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.ib-person .rcp input[type=text], .ib-person .rcp input[type=text]:focus, .ib-person .rcp input[type=text]:focus-visible {
  border: 0 !important; outline: none !important; box-shadow: none !important; background: transparent !important; }

/* Read confirmation under the conversation: "I read this", and who has read the latest message */
.ib-read { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin: .5rem 0 1rem; }
.ib-ack { min-height: 44px; }
.ib-read-who { margin: 0; color: var(--muted); }
.ib-read-yes { color: var(--tint-ink); }

/* Also send by email: off unless ticked (owner, 2026-11-06) */
.ib-email .help { margin: .15rem 0 0; }
.ib-item-note { color: var(--muted); font-size: .95rem; margin-top: .15rem; }
.ib-items li .ib-photos { margin: .4rem 0 .2rem; }
