/* Messenger: one page, and its own width decides (Build 2, section 6).  A container query on the page, not the device. */
:root {
  --bg: #f4f5f7; --panel: #ffffff; --ink: #16181d; --soft: #5d6470; --line: #e2e5ea; --mine: #1f6feb; --mine-ink: #ffffff;
  --theirs: #eef0f3; --accent: #1f6feb; --good: #1a8f4c; --warn: #b35900; --chip: #eef1f5; --chip-on: #16181d; --chip-on-ink: #ffffff;
  --tap: 44px; --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
/* Step 4: Light, Dark, or Match This Device (public/theme.js sets data-theme before the first paint) */
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; --bg: #0f1115; --panel: #171a20; --ink: #e9ecf1; --soft: #9aa3b1; --line: #262b33; --theirs: #222731; --chip: #222731; --chip-on: #e9ecf1; --chip-on-ink: #0f1115; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) { color-scheme: dark; --bg: #0f1115; --panel: #171a20; --ink: #e9ecf1; --soft: #9aa3b1; --line: #262b33; --theirs: #222731; --chip: #222731; --chip-on: #e9ecf1; --chip-on-ink: #0f1115; }
}
@media (pointer: coarse) { :root { --tap: 52px; } }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { overflow: hidden; }
#root { height: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.boot { display: grid; place-items: center; height: 100%; }
.boot-words { color: var(--soft); }

/* the door */
.door { max-width: 380px; margin: 12vh auto 0; padding: 28px 24px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.door h1 { margin: 0 0 6px; font-size: 24px; }
.door p { color: var(--soft); margin: 0 0 18px; line-height: 1.45; }
.door input[type=text] { width: 100%; font-size: 28px; letter-spacing: 8px; text-align: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.door label { display: flex; gap: 8px; align-items: center; margin: 14px 0; color: var(--soft); }
.door .go { width: 100%; min-height: var(--tap); border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; }
.door .err { color: #c0352b; min-height: 1.3em; margin: 10px 0 0; }

/* the app */
.mg { container-type: inline-size; display: flex; flex-direction: column; height: 100%; background: var(--panel); }
.mg-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px 6px; }
.mg-top b { font-size: 18px; }
.mg-top .spacer { flex: 1; }
.mg-top button { min-height: 34px; border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 0 12px; color: var(--soft); }
.mg-lock { font-size: 12px; color: var(--soft); padding: 0 14px 8px; border-bottom: 1px solid var(--line); }
.mg-error { background: #fdecea; color: #8a1c13; padding: 8px 14px; font-size: 14px; }
.mg-panes { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }
.mg-left { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.mg-chips { display: flex; gap: 6px; padding: 10px 12px; overflow-x: auto; border-bottom: 1px solid var(--line); flex: none; }
.mg-chips button { border: 0; background: var(--chip); border-radius: 999px; padding: 6px 12px; white-space: nowrap; min-height: 32px; }
.mg-chips button.is-on { background: var(--chip-on); color: var(--chip-on-ink); }
.mg-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.mg-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 14px; min-height: 64px; border-bottom: 1px solid var(--line); }
.mg-row.is-on { background: var(--theirs); }
.mg-row.is-unread .mg-row-name { font-weight: 700; }
.mg-ava { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: hsl(var(--h, 210) 55% 45%); position: relative; }
.mg-ava.is-team { background: hsl(150 40% 38%); }
.mg-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mg-row-name { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-row-last { font-size: 14px; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; color: var(--soft); }
.mg-badge { background: var(--accent); color: #fff; border-radius: 999px; min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; font-weight: 700; }
.mg-tag { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 0 6px 6px 0; padding: 1px 6px; margin-left: 6px; vertical-align: 1px; background: var(--chip); color: var(--soft); border-left: 3px solid var(--tagc, var(--soft)); }
.mg-empty { padding: 20px 16px; color: var(--soft); line-height: 1.45; }
.mg-side { display: none; min-height: 0; }
.mg-pick { display: grid; place-items: center; height: 100%; color: var(--soft); }
.mg.is-open .mg-left { display: none; }
.mg.is-open .mg-side { display: flex; }
.mg-convo { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.mg-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); min-height: 56px; }
.mg-back { border: 0; background: transparent; min-width: var(--tap); min-height: var(--tap); font-size: 22px; }
.mg-head-name { font-weight: 700; font-size: 17px; }
.mg-head-sub { color: var(--soft); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-scroll { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.mg-b-row { display: flex; }
.mg-b-row.is-mine { justify-content: flex-end; }
.mg-bubble { max-width: min(78%, 520px); background: var(--theirs); border-radius: 16px; padding: 8px 12px; }
.is-mine .mg-bubble { background: var(--mine); color: var(--mine-ink); }
.mg-b-who { font-size: 12px; font-weight: 700; color: var(--soft); margin-bottom: 2px; }
.mg-b-text { white-space: pre-wrap; word-wrap: break-word; line-height: 1.4; }
.mg-b-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; font-size: 11px; opacity: .75; margin-top: 3px; }
.mg-ticks { border: 0; background: transparent; color: inherit; padding: 0; font-size: 12px; }
.mg-detail { margin: 6px 0 0; padding: 6px 0 0; border-top: 1px solid rgba(255,255,255,.3); list-style: none; font-size: 12px; }
.mg-photo { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; }
.mg-compose { display: flex; gap: 8px; align-items: flex-end; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.mg-icon { flex: none; width: var(--tap); height: var(--tap); border: 0; border-radius: 50%; background: var(--chip); display: grid; place-items: center; font-size: 20px; }
.mg-box { flex: 1; min-width: 0; min-height: var(--tap); max-height: 160px; overflow-y: auto; overflow-x: hidden; border: 1px solid var(--line); border-radius: 22px; padding: 11px 14px; background: var(--bg); line-height: 1.35; outline: none; overflow-wrap: anywhere; cursor: text; }
.mg-box:focus { border-color: var(--accent); }
.mg-send { flex: none; min-height: var(--tap); border: 0; border-radius: 22px; background: var(--accent); color: #fff; font-weight: 600; padding: 0 16px; }
.mg-send:disabled, .mg-icon:disabled { opacity: .5; }

@container (min-width: 700px) {
  .mg-panes { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
  .mg-left { border-right: 1px solid var(--line); }
  .mg-side { display: flex; }
  .mg.is-open .mg-left { display: flex; }
  .mg-back { display: none; }
}

/* ── Step 1, December 1, 2026: live dot, alert line, typing, Settings and the People page ── */
.mg-live { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.mg-live.is-on { background: var(--good); }
.mg-top button { white-space: nowrap; }
.mg-alertline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 14px; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); border-bottom: 1px solid var(--line); font-size: 14px; }
.mg-alertline[hidden] { display: none; }
.mg-alertline span { flex: 1 1 220px; line-height: 1.35; }
.mg-alertline button, .sh-row button, .pp-inline button, .sh-head button { min-height: 34px; border-radius: 8px; padding: 0 12px; border: 1px solid var(--line); background: var(--panel); }
.mg-alertline button:not(.quiet), .go-small { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; font-weight: 600; }
.go-small { display: inline-flex; align-items: center; min-height: 34px; border-radius: 8px; padding: 0 12px; text-decoration: none; }
.mg-typing { padding: 2px 16px 4px; font-size: 13px; color: var(--soft); font-style: italic; min-height: 0; }
.mg-typing[hidden] { display: none; }

.mg.is-sheet .mg-panes { display: none; }
.mg-sheet { flex: 1; overflow-y: auto; padding: 0 16px 24px; min-height: 0; }
.mg-sheet[hidden] { display: none; }
.sh-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--panel); padding: 12px 0 8px; z-index: 1; }
.sh-head h2 { margin: 0; font-size: 20px; }
.mg-sheet section { border-top: 1px solid var(--line); padding: 12px 0; }
.mg-sheet h3 { margin: 14px 0 6px; font-size: 15px; }
.mg-sheet section h3 { margin-top: 0; }
.mg-sheet p { margin: 6px 0; line-height: 1.45; }
.sh-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.sh-note { color: var(--soft); font-size: 13px; }
.sh-check { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-weight: 600; }

.pp-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 8px; }
.pp-tabs button { border: 0; background: var(--chip); border-radius: 999px; padding: 6px 12px; white-space: nowrap; min-height: 32px; }
.pp-tabs button.is-on { background: var(--chip-on); color: var(--chip-on-ink); }
.pp-note { min-height: 1.2em; color: var(--accent); font-size: 14px; margin: 2px 0 6px; }
.pp-add { border: 1px dashed var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.pp-add summary { cursor: pointer; font-weight: 600; min-height: 28px; display: flex; align-items: center; }
.pp-add form { display: grid; gap: 10px; margin-top: 10px; }
.pp-add label { display: grid; gap: 4px; font-size: 14px; }
.pp-add input[type=text], .pp-add input:not([type]), .pp-inline input, .pp-inline select { min-height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--bg); font: inherit; color: inherit; }
.pp-add fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pp-add legend { font-size: 14px; margin-bottom: 4px; }
.pp-add .go-small { justify-self: start; }
.pp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pp-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pp-card.is-off { opacity: .6; }
.pp-who { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 12px; }
.pp-who-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pp-who-text > span { color: var(--soft); font-size: 13px; }
.pp-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pp-tags em { font-style: normal; font-size: 11px; font-weight: 600; background: var(--chip); border-radius: 6px; padding: 1px 6px; color: var(--ink); }
.pp-more { padding: 0 12px 12px; border-top: 1px solid var(--line); }
.pp-more h4 { margin: 12px 0 6px; font-size: 13px; color: var(--soft); }
.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; margin-top: 10px; }
.pp-flag, .pp-chip { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; min-height: 32px; }
.pp-chip { background: var(--chip); border-radius: 999px; padding: 2px 10px; }
.pp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pp-rows li { display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 14px; }
.pp-inline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.pp-inline input, .pp-inline select { flex: 1 1 160px; }
.pp-code { font-size: 26px; font-weight: 700; letter-spacing: 6px; font-variant-numeric: tabular-nums; }
.pp-team, .pp-wait { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; }
.pp-wait { flex-direction: column; align-items: stretch; }
.pp-swatch { width: 14px; height: 14px; border-radius: 4px; background: var(--tagc, #888); flex: none; }

/* A narrow page (a phone, or a drawer): the top bar's buttons shrink, and wrap rather than run off the edge (found in /verify, December 1, 2026: an admin's Sign Out was cut off at 375). */
.mg-top { flex-wrap: wrap; row-gap: 6px; }
@container (max-width: 479px) {
  .mg-top { gap: 6px; padding: 8px 10px 4px; }
  .mg-top b { font-size: 16px; }
  .mg-top button { padding: 0 8px; min-height: 32px; font-size: 14px; }
}

/* ── Step 2, December 1, 2026: A Real Conversation ── */
.mg { position: relative; }
.mg-offscreen { position: fixed; left: -9999px; top: 0; }
.mg-find { display: flex; gap: 6px; padding: 10px 12px 0; flex: none; }
.mg-find input { flex: 1; min-width: 0; min-height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--bg); }
.mg-find button { flex: none; min-height: 36px; border: 1px solid var(--line); border-radius: 10px; background: transparent; padding: 0 10px; color: var(--soft); white-space: nowrap; }
.mg-chip-n { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; margin-left: 2px; }
.mg-sect { padding: 10px 14px 4px; font-size: 12px; font-weight: 700; color: var(--soft); text-transform: none; letter-spacing: .02em; }
.mg-hit { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 10px 14px; }
.mg-hit-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.mg-hit-top span { color: var(--soft); font-size: 12px; flex: none; }
.mg-hit-text { font-size: 14px; color: var(--soft); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mg-hit mark { background: color-mix(in srgb, #f5c400 55%, transparent); color: inherit; border-radius: 3px; }
.mg-row-marks { display: flex; gap: 4px; align-items: center; }
.mg-mark { font-size: 12px; opacity: .8; }
.mg-badge.is-muted { background: var(--soft); }
.mg-badge.is-at { background: var(--accent); }
.mg-ava.is-group { background: hsl(var(--h, 280) 45% 45%); font-size: 15px; }

/* the conversation */
.mg-convo { position: relative; }
.mg-head-who { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; padding: 0; display: flex; flex-direction: column; cursor: default; }
.mg-head-who.is-link { cursor: pointer; }
.mg-head-who.is-link .mg-head-name::after { content: " \203A"; color: var(--soft); }
.mg-head-more { flex: none; min-width: 40px; min-height: 40px; border: 0; background: transparent; font-size: 20px; border-radius: 10px; color: var(--soft); }
.mg-head-more[hidden] { display: none; }
.mg-pinbar { display: flex; gap: 8px; align-items: center; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 6%, var(--panel)); padding: 6px 14px; text-align: left; font-size: 13px; min-height: 36px; }
.mg-pinbar[hidden] { display: none; }
.mg-pinbar-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-pinbar-n { flex: none; color: var(--soft); font-size: 12px; }
.mg-day { display: flex; justify-content: center; margin: 10px 0 4px; }
.mg-day span { font-size: 12px; font-weight: 600; color: var(--soft); background: var(--chip); border-radius: 999px; padding: 3px 10px; }
.mg-unreadline { display: flex; align-items: center; gap: 8px; margin: 6px 0; color: var(--accent); font-size: 12px; font-weight: 700; }
.mg-unreadline::before, .mg-unreadline::after { content: ""; flex: 1; height: 1px; background: var(--accent); opacity: .5; }
.mg-sys { align-self: center; max-width: 90%; text-align: center; font-size: 12px; color: var(--soft); padding: 2px 8px; }
.mg-earlier { align-self: center; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 14px; color: var(--soft); min-height: 32px; }
.mg-b-row { align-items: center; gap: 4px; min-width: 0; }
.mg-b-row.is-mine { flex-direction: row-reverse; justify-content: flex-start; }
.mg-b-col { display: flex; flex-direction: column; max-width: min(78%, 520px); min-width: 0; }
.mg-b-row.is-mine .mg-b-col { align-items: flex-end; }
.mg-b-col .mg-bubble { max-width: 100%; }
.mg-bubble { -webkit-touch-callout: none; }
@media (pointer: coarse) { .mg-bubble { -webkit-user-select: none; user-select: none; } }
.mg-bubble.is-gone { background: transparent; border: 1px dashed var(--line); color: var(--soft); font-style: italic; font-size: 14px; }
.is-mine .mg-bubble.is-gone { background: transparent; color: var(--soft); }
.mg-b-more { flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--soft); opacity: 0; font-size: 18px; }
.mg-b-row:hover .mg-b-more, .mg-b-more:focus-visible { opacity: 1; }
@media (pointer: coarse) { .mg-b-more { display: none; } }
.mg-b-row.is-hit .mg-bubble { outline: 3px solid #f5c400; outline-offset: 2px; }
.mg-b-fwd { font-size: 12px; font-style: italic; opacity: .8; margin-bottom: 2px; }
.mg-b-quote { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; border: 0; border-left: 3px solid currentColor; background: rgba(127,127,127,.15); border-radius: 6px; padding: 4px 8px; margin: 2px 0 4px; color: inherit; font-size: 13px; }
.mg-b-quote span { opacity: .85; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mg-b-edited { font-style: italic; }
.mg-at { font-weight: 700; }
.mg-at.is-me { background: color-mix(in srgb, #f5c400 45%, transparent); border-radius: 4px; padding: 0 2px; }
.is-mine .mg-at.is-me { background: rgba(255,255,255,.25); }
.mg-rx { display: flex; flex-wrap: wrap; gap: 4px; margin-top: -6px; padding: 0 6px; position: relative; z-index: 1; }
.mg-rx button { display: inline-flex; gap: 3px; align-items: center; min-height: 26px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.mg-rx button.is-mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.mg-rx button span { font-size: 12px; color: var(--soft); }
.mg-detail li { margin: 2px 0; }
.mg-jump { position: absolute; right: 16px; bottom: 84px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 2px 8px rgba(0,0,0,.15); font-size: 18px; z-index: 2; }
.mg-jump[hidden] { display: none; }
.mg-jump-n { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }
.mg-jump-n[hidden] { display: none; }

/* the compose area */
.mg-composebar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-top: 1px solid var(--line); background: var(--bg); }
.mg-composebar[hidden] { display: none; }
.mg-composebar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; border-left: 3px solid var(--accent); padding-left: 8px; }
.mg-composebar-text span { color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-composebar button { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--chip); }
.mg-suggest { display: flex; flex-direction: column; border-top: 1px solid var(--line); max-height: 220px; overflow-y: auto; background: var(--panel); }
.mg-suggest[hidden] { display: none; }
.mg-suggest button { text-align: left; border: 0; background: transparent; padding: 8px 14px; min-height: 38px; }
.mg-suggest button.is-on { background: var(--theirs); }
.mg-emoji { border-top: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; height: 280px; max-height: 45vh; }
.mg-emoji[hidden] { display: none; }
.mg-emoji-top { display: flex; gap: 6px; padding: 8px 10px 4px; }
.mg-emoji-top input { flex: 1; min-width: 0; min-height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--bg); }
.mg-emoji-top button { min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: transparent; padding: 0 10px; }
.mg-emoji-cats { display: flex; gap: 2px; padding: 0 8px 4px; overflow-x: auto; flex: none; }
.mg-emoji-cats button { flex: none; width: 34px; height: 32px; border: 0; border-radius: 8px; background: transparent; font-size: 18px; opacity: .6; }
.mg-emoji-cats button.is-on { opacity: 1; background: var(--chip); }
.mg-emoji-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 2px; padding: 4px 8px 8px; align-content: start; }
.mg-emoji-grid button { height: 40px; border: 0; border-radius: 8px; background: transparent; font-size: 24px; }
.mg-emoji-grid button:hover, .mg-emoji-grid button:focus-visible { background: var(--chip); }

/* the floating menu */
.mg-menu { position: fixed; z-index: 50; width: min(272px, calc(100vw - 16px)); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.22); padding: 6px; }
.mg-menu[hidden] { display: none; }
.mg-menu-emoji { display: flex; justify-content: space-between; padding: 2px 2px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.mg-menu-emoji button { width: 34px; height: 36px; border: 0; border-radius: 50%; background: transparent; font-size: 22px; padding: 0; }
.mg-menu-emoji button:hover, .mg-menu-emoji button.is-on { background: var(--chip); }
.mg-menu-emoji [data-react-more] { font-size: 20px; font-weight: 700; color: var(--soft); background: var(--chip); }
.mg-menu-items { display: flex; flex-direction: column; }
.mg-menu-items button { text-align: left; border: 0; background: transparent; border-radius: 8px; padding: 0 12px; min-height: 38px; }
.mg-menu-items button:hover, .mg-menu-items button:focus-visible { background: var(--theirs); }
.is-danger { color: #c0352b !important; }
.mg-menu-ask { margin: 6px 8px 8px; font-size: 14px; line-height: 1.4; }
.mg-menu-who { padding: 4px 8px; }
.mg-menu-big { font-size: 28px; }
.mg-menu-who ul { list-style: none; margin: 4px 0; padding: 0; font-size: 14px; }
.mg-menu-who li { padding: 3px 0; }
.mg-toast { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); max-width: calc(100% - 32px); background: var(--ink); color: var(--panel); border-radius: 10px; padding: 8px 14px; font-size: 14px; z-index: 60; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.mg-toast[hidden] { display: none; }

/* sheets: forward, new group, group info, the favorite */
.sh-find { width: 100%; min-height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--bg); margin: 6px 0; }
.sh-form { display: grid; gap: 8px; }
.sh-form label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.sh-form input[name=name], .mg-sheet form input[name=name] { min-height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--bg); font: inherit; color: inherit; flex: 1 1 180px; min-width: 0; }
.sh-people { display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; margin: 4px 0 10px; }
.sh-person { display: flex; gap: 10px; align-items: center; min-height: 48px; padding: 2px 4px; border-radius: 10px; }
.sh-person .mg-ava { width: 34px; height: 34px; font-size: 13px; }
.sh-fav button { font-size: 22px; width: 44px; height: 40px; padding: 0; }
.sh-fav button.is-on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.mg-sheet [data-leave] { min-height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); padding: 0 12px; }
.pp-rows button { min-height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); padding: 0 10px; }
@container (max-width: 479px) {
  .mg-find button[data-newgroup] { padding: 0 8px; font-size: 14px; }
  .mg-icon { width: 40px; height: 40px; font-size: 18px; }
  .mg-compose { gap: 6px; }
  .mg-send { padding: 0 12px; }
  .mg-b-col { max-width: 84%; }
}

/* The tabs wrap onto a second line rather than hide past the edge: a mouse cannot easily scroll sideways (found in the Step 2 drive's pictures). */
.mg-chips { flex-wrap: wrap; overflow-x: visible; row-gap: 6px; }
.mg-chips button { padding: 4px 10px; min-height: 30px; font-size: 14px; }
.mg-menu.is-arming { pointer-events: none; }


/* ═══════════ Step 3, Send Anything (December 1, 2026) ═══════════ */
/* the box where you type is a rich editor: its placeholder, and what formatting looks like inside it */
.mg-box.is-empty::before { content: attr(data-placeholder); color: var(--soft); pointer-events: none; }
.mg-box p, .mg-box blockquote, .mg-box pre, .mg-box ul, .mg-box ol { margin: 0; }
.mg-box ul, .mg-box ol { padding-left: 22px; }
.mg-box blockquote { border-left: 3px solid var(--line); padding-left: 8px; color: var(--soft); }
.mg-box pre, .mg-box code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; background: var(--chip); border-radius: 4px; }
.mg-box pre { padding: 6px 8px; white-space: pre-wrap; }
.mg-box table { border-collapse: collapse; margin: 4px 0; max-width: 100%; display: block; overflow-x: auto; }
.mg-box td, .mg-box th { border: 1px solid var(--line); padding: 3px 6px; min-width: 40px; }
.mg-box a { color: var(--accent); }
.mg-icon[data-plus] { font-size: 26px; font-weight: 300; }
.mg-icon[data-mic].is-rec { background: #d93025; color: #fff; }

/* a document in a bubble, drawn by hand */
.mg-b-doc { white-space: normal; }
.mg-b-doc p { margin: 0; white-space: pre-wrap; }
.mg-b-doc p + p, .mg-b-doc p + ul, .mg-b-doc p + ol, .mg-b-doc ul + p, .mg-b-doc ol + p, .mg-b-doc blockquote, .mg-b-doc pre, .mg-b-doc .mg-table { margin-top: 4px; }
.mg-b-doc ul, .mg-b-doc ol { margin: 2px 0; padding-left: 22px; }
.mg-b-doc blockquote { margin: 4px 0; padding-left: 9px; border-left: 3px solid currentColor; opacity: .85; }
.mg-b-doc pre { margin: 4px 0; padding: 7px 9px; border-radius: 8px; background: rgba(0,0,0,.07); overflow-x: auto; white-space: pre; }
.is-mine .mg-b-doc pre { background: rgba(255,255,255,.16); }
.mg-b-doc code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; }
.mg-b-doc :not(pre) > code { background: rgba(0,0,0,.07); padding: 0 3px; border-radius: 4px; }
.is-mine .mg-b-doc :not(pre) > code { background: rgba(255,255,255,.18); }
.mg-b-doc a { color: inherit; text-decoration: underline; }
.mg-table { margin: 6px 0 2px; max-width: 100%; }
.mg-table-scroll { overflow-x: auto; width: fit-content; max-width: 100%; border-radius: 8px; background: var(--panel); color: var(--ink); -webkit-overflow-scrolling: touch; }
.mg-table table { border-collapse: collapse; font-size: 14px; }
.mg-table th, .mg-table td, .tp table th, .tp table td { border: 1px solid var(--line); padding: 5px 9px; vertical-align: top; text-align: left; white-space: nowrap; }
.mg-table th, .tp table th { background: var(--chip); font-weight: 600; }
.mg-table td p, .mg-table th p, .tp td p, .tp th p { margin: 0; white-space: nowrap; }
.mg-table .al-c, .tp .al-c { text-align: center; }
.mg-table .al-r, .tp .al-r { text-align: right; }
.mg-table-tools { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.mg-table-btn { border: 0; border-radius: 999px; padding: 3px 10px; font-size: 12px; background: rgba(0,0,0,.08); color: inherit; }
.is-mine .mg-table-btn { background: rgba(255,255,255,.2); }
.mg-bubble { min-width: 0; }
.mg-b-col { min-width: 0; }

/* photos in a grid */
.mg-grid { display: grid; gap: 3px; border-radius: 12px; overflow: hidden; width: 280px; max-width: 100%; margin: 2px 0; }
.mg-grid.n1 { grid-template-columns: 1fr; width: auto; max-width: 100%; }
.mg-grid.n2 { grid-template-columns: 1fr 1fr; }
.mg-grid.n3 { grid-template-columns: 1fr 1fr; }
.mg-grid.n3 .mg-g:first-child { grid-column: span 2; }
.mg-grid.n4 { grid-template-columns: 1fr 1fr; }
.mg-g { position: relative; border: 0; padding: 0; background: rgba(0,0,0,.08); display: block; min-width: 0; }
.mg-grid:not(.n1) .mg-g { aspect-ratio: 1; }
.mg-grid:not(.n1) .mg-g .mg-photo { width: 100%; height: 100%; max-height: none; object-fit: cover; border-radius: 0; }
.mg-grid.n1 .mg-photo { border-radius: 12px; }
.mg-grid.n3 .mg-g:first-child { aspect-ratio: 2; }
.mg-g-more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45); color: #fff; font-size: 24px; font-weight: 600; }

/* video, in place */
.mg-video { position: relative; width: 300px; max-width: 100%; border-radius: 12px; overflow: hidden; background: #000; margin: 2px 0; }
.mg-vid { display: block; width: 100%; max-height: 360px; background: #000; }
.mg-vid-full { position: absolute; inset: 0; border: 0; background: transparent; }
.mg-vid-sound, .mg-vid-play { position: absolute; border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; }
.mg-vid-sound { right: 8px; bottom: 8px; width: 38px; height: 38px; font-size: 18px; }
.mg-vid-sound.is-on { background: var(--accent); }
.mg-vid-play { left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; font-size: 22px; }
.mg-vid-play[hidden] { display: none; }
.mg-vid-len { position: absolute; left: 8px; bottom: 10px; color: #fff; font-size: 12px; background: rgba(0,0,0,.5); padding: 1px 6px; border-radius: 999px; pointer-events: none; }

/* audio and voice memos: a play button and a waveform */
.mg-audio { display: flex; align-items: center; gap: 9px; min-width: 210px; max-width: 100%; padding: 2px 0; }
.mg-play { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 14px; display: grid; place-items: center; }
.is-mine .mg-play { background: #fff; color: var(--mine); }
.mg-audio-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mg-audio-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-wave { display: flex; align-items: center; gap: 2px; height: 30px; cursor: pointer; }
.mg-wave i { flex: 1; min-width: 2px; max-width: 4px; border-radius: 2px; background: currentColor; opacity: .35; height: 30%; }
.mg-wave i.is-done { opacity: 1; }
.mg-dur { flex: none; font-size: 12px; opacity: .8; font-variant-numeric: tabular-nums; }

/* a file: a card with Download, never opened here */
.mg-filecard { display: flex; align-items: center; gap: 10px; padding: 8px; margin: 2px 0; border-radius: 10px; background: rgba(0,0,0,.06); max-width: 100%; min-width: 220px; }
.is-mine .mg-filecard { background: rgba(255,255,255,.16); }
.mg-fileicon { flex: none; width: 40px; height: 48px; border-radius: 6px; background: var(--panel); color: var(--soft); display: grid; place-items: center; font-size: 20px; }
.mg-filecard.is-pdf .mg-fileicon { color: #c0352b; font-size: 13px; font-weight: 700; }
.mg-filecard.is-program .mg-fileicon { color: var(--warn); }
.mg-filetext { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.mg-filetext b { font-size: 14px; overflow-wrap: anywhere; }
.mg-filetext span { opacity: .8; }
.mg-prog-warn { font-style: normal; font-weight: 600; color: var(--warn); margin-top: 3px; }
.is-mine .mg-prog-warn { color: #ffd38a; }
.mg-file-note { font-style: normal; margin-top: 3px; }
.mg-dl { flex: none; border-radius: 999px; padding: 6px 12px; background: var(--accent); color: #fff; text-decoration: none; font-size: 13px; font-weight: 600; }
.is-mine .mg-dl { background: #fff; color: var(--mine); }

/* the tray: each upload with its progress bar and Cancel */
.mg-tray { border-top: 1px solid var(--line); padding: 6px 10px; background: var(--panel); max-height: 34vh; overflow-y: auto; }
.mg-tray ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mg-up { display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "name size btn" "bar words btn"; gap: 2px 8px; align-items: center; font-size: 13px; }
.mg-up-name { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mg-up-size { grid-area: size; color: var(--soft); }
.mg-up progress { grid-area: bar; width: 100%; height: 6px; accent-color: var(--accent); }
.mg-up-words { grid-area: words; color: var(--soft); font-variant-numeric: tabular-nums; min-width: 3em; text-align: right; }
.mg-up.is-failed .mg-up-words { color: #c0352b; grid-column: 1 / 3; text-align: left; }
.mg-up.is-failed progress { display: none; }
.mg-up button { grid-area: btn; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 4px 10px; font-size: 12px; }

/* the format bar, while words are selected */
.mg-fmt { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 10px; border-top: 1px solid var(--line); background: var(--panel); }
.mg-fmt[hidden], .mg-tray[hidden], .mg-rec[hidden], .mg-drop[hidden] { display: none; }
.mg-fmt > button { min-width: 34px; height: 32px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 0 8px; font-size: 13px; }
.mg-fmt-link { display: flex; gap: 6px; width: 100%; }
.mg-fmt-link input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--bg); }
.mg-fmt-link button { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 0 10px; }

/* recording a voice memo */
.mg-rec { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--panel); font-size: 14px; }
.mg-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #d93025; animation: mg-blink 1s infinite; }
@keyframes mg-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .mg-rec-dot { animation: none; } }
.mg-rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.mg-rec-level { width: 60px; height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; }
.mg-rec-level i { display: block; height: 100%; width: 0; background: #d93025; }
.mg-rec-words { flex: 1; min-width: 0; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-rec button { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 4px 12px; }

/* drop a file on the conversation */
.mg-convo { position: relative; }
.mg-drop { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(31,111,235,.12); border: 3px dashed var(--accent); border-radius: 12px; pointer-events: none; }
.mg-drop span { background: var(--accent); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; }

/* full screen: swipe between photos and videos */
.mg-lb { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.94); color: #fff; display: flex; flex-direction: column; outline: none; touch-action: pan-y; }
.mg-lb[hidden] { display: none; }
.mg-lb-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px calc(8px); font-size: 13px; }
.mg-lb-top .spacer { flex: 1; }
.mg-lb-btn { border: 0; background: rgba(255,255,255,.14); color: #fff; border-radius: 999px; padding: 6px 12px; text-decoration: none; font-size: 13px; }
.mg-lb-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 6px; }
.mg-lb-stage img, .mg-lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.mg-lb-prev, .mg-lb-next { position: absolute; top: 50%; width: 46px; height: 64px; margin-top: -32px; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 34px; border-radius: 10px; }
.mg-lb-prev { left: 8px; } .mg-lb-next { right: 8px; }
.mg-lb-prev[hidden], .mg-lb-next[hidden] { display: none; }

/* the gallery of a chat */
.gl-tabs { display: flex; gap: 6px; margin: 4px 0 12px; flex-wrap: wrap; }
.gl-tabs button { border: 0; border-radius: 999px; padding: 6px 14px; background: var(--chip); }
.gl-tabs button.is-on { background: var(--chip-on); color: var(--chip-on-ink); }
.gl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 3px; }
.gl-cell { position: relative; aspect-ratio: 1; border: 0; padding: 0; background: var(--chip); overflow: hidden; }
.gl-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gl-play, .gl-vid { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 22px; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.gl-files, .gl-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.gl-who { font-size: 12px; color: var(--soft); margin-bottom: 2px; }
.gl-files .mg-filecard { background: var(--chip); }
.gl-links li { display: flex; flex-direction: column; gap: 2px; }
.gl-links a { color: var(--accent); overflow-wrap: anywhere; }
.gl-links span { font-size: 12px; color: var(--soft); }

/* Open Full Size: one table in Messenger's own window */
.tp { height: 100%; display: flex; flex-direction: column; background: var(--panel); }
.tp-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tp-head .spacer { flex: 1; }
.tp-head button { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 14px; }
.tp-body { flex: 1; overflow: auto; padding: 14px; }
.tp table { border-collapse: collapse; font-size: 14px; }

@container (max-width: 479px) {
  .mg-filecard, .mg-audio { min-width: 0; }
  .mg-grid:not(.n1), .mg-video { width: 260px; }
}

/* ── Step 4, December 1, 2026: Make It Yours ── */
/* faces: a photo over the initials, and the status dot */
.mg-ava { overflow: visible; }
.mg-ava.has-photo { color: transparent; }
.mg-ava-img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--chip); }
.mg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--panel); background: var(--soft); flex: none; box-sizing: content-box; }
.mg-ava .mg-dot { position: absolute; right: -1px; bottom: -1px; }
.mg-dot.is-available { background: #1a8f4c; }
.mg-dot.is-away { background: #d9a300; }
.mg-dot.is-dnd { background: #c0352b; }
.mg-dot.is-off { background: #8a919c; }
.mg-ava.is-small { width: 30px; height: 30px; font-size: 12px; }
.mg-ava.is-small .mg-dot { width: 7px; height: 7px; }
.mg-ava.is-head { width: 36px; height: 36px; font-size: 14px; }
.mg-ava.is-big { width: 96px; height: 96px; font-size: 34px; }
.mg-ava.is-big .mg-dot { width: 16px; height: 16px; border-width: 3px; right: 2px; bottom: 2px; }
.mg-ava.is-group { background: hsl(var(--h, 30) 45% 42%); position: relative; }
.mg-me { padding: 0 !important; border: 0 !important; background: transparent !important; min-height: 30px !important; border-radius: 50% !important; display: grid; place-items: center; }
.mg-row-away { font-size: 13px; color: var(--soft); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-head-face { flex: none; cursor: pointer; display: grid; }
.mg-head-face:empty { display: none; }
button.mg-b-who { display: block; border: 0; background: transparent; padding: 0; text-align: left; font: inherit; font-size: 12px; font-weight: 700; color: var(--soft); cursor: pointer; }
button.mg-b-who:hover { text-decoration: underline; }
/* the away message, right above the box, read before sending */
.mg-awayline { display: flex; gap: 8px; align-items: center; padding: 6px 14px; font-size: 13px; color: var(--ink); background: color-mix(in srgb, #d9a300 12%, var(--panel)); border-top: 1px solid var(--line); line-height: 1.35; overflow-wrap: anywhere; }
.mg-awayline[hidden] { display: none; }
.mg-awayline .mg-dot { border: 0; }

/* backgrounds: only yours, nobody else ever sees them (Decision 7).  Each keeps the words readable in light and dark. */
.mg-scroll.bg-paper, .pf-bg.bg-paper { background: color-mix(in srgb, #c8b48a 14%, var(--panel)); }
.mg-scroll.bg-sky, .pf-bg.bg-sky { background: color-mix(in srgb, #5aa9e6 18%, var(--panel)); }
.mg-scroll.bg-mint, .pf-bg.bg-mint { background: color-mix(in srgb, #3fb58a 16%, var(--panel)); }
.mg-scroll.bg-sand, .pf-bg.bg-sand { background: color-mix(in srgb, #e0b46a 18%, var(--panel)); }
.mg-scroll.bg-rose, .pf-bg.bg-rose { background: color-mix(in srgb, #e08aa0 16%, var(--panel)); }
.mg-scroll.bg-slate, .pf-bg.bg-slate { background: color-mix(in srgb, #5d6878 22%, var(--panel)); }
.mg-scroll.bg-dots, .pf-bg.bg-dots { background-color: var(--panel); background-image: radial-gradient(color-mix(in srgb, var(--soft) 30%, transparent) 1.2px, transparent 1.4px); background-size: 18px 18px; }
.mg-scroll.bg-grid, .pf-bg.bg-grid { background-color: var(--panel); background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 24px 24px; }
.mg-scroll.bg-lines, .pf-bg.bg-lines { background-color: var(--panel); background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--soft) 14%, transparent) 0 2px, transparent 2px 14px); }
.mg-scroll.bg-waves, .pf-bg.bg-waves { background-color: color-mix(in srgb, #5aa9e6 8%, var(--panel)); background-image: radial-gradient(circle at 50% 120%, transparent 14px, color-mix(in srgb, #5aa9e6 22%, transparent) 15px, transparent 17px); background-size: 34px 20px; }
/* my own photo, dimmed with the page's own color so words stay readable */
.mg-scroll.bg-photo, .pf-bg.bg-photo { background-image: linear-gradient(color-mix(in srgb, var(--panel) 72%, transparent), color-mix(in srgb, var(--panel) 72%, transparent)), var(--bgimg, none); background-size: cover; background-position: center; background-attachment: local; }
.mg-scroll.bg-photo { background-attachment: scroll; }

/* the profile sheets */
.pf-top { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.pf-who { min-width: 0; flex: 1 1 180px; display: flex; flex-direction: column; gap: 4px; }
.pf-name { font-size: 24px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.pf-hats { font-size: 14px; color: var(--soft); }
.pf-hats:empty { display: none; }
.pf-status-line { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.pf-status-line .mg-dot { border: 0; }
.pf-away-show { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, #d9a300 12%, var(--panel)); border: 1px solid var(--line); font-style: italic; overflow-wrap: anywhere; }
.pf-status { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-status button, .st-theme button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); padding: 0 12px; }
.pf-status button.is-on, .st-theme button.is-on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); font-weight: 600; }
.pf-status .mg-dot { border: 0; }
.pf-until select, .st-sound select { min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 0 8px; }
.pf-until input[type=date], .st-quiet input[type=time] { min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 0 8px; }
.pf-away, .pf-hatlist input, .pf-phones input { width: 100%; min-height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--bg); }
.pf-hatlist { display: grid; gap: 6px; }
.pf-phones { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.pf-phones label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--soft); }
.pf-saved { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-chip { display: inline-flex; max-width: 100%; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.pf-chip button { border: 0; background: var(--chip); padding: 6px 10px; min-height: 32px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.pf-chip button + button { background: transparent; color: var(--soft); max-width: none; }
.pf-phonelist { list-style: none; margin: 0; padding: 0; }
.pf-phonelist li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pf-phonelist a { color: var(--accent); }
.pf-cropbox[hidden] { display: none; }
.pf-crop { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; margin-top: 10px; }
.pf-crop-stage { position: relative; width: 260px; height: 260px; max-width: 100%; touch-action: none; border-radius: 12px; overflow: hidden; background: #000; }
.pf-crop-stage canvas { width: 260px; height: 260px; display: block; cursor: grab; }
.pf-crop-ring { position: absolute; inset: 0; pointer-events: none; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0, 0, 0, .5); border: 2px solid #fff; }
.pf-crop-zoom { display: flex; gap: 8px; align-items: center; }
.pf-bgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 8px 0; }
.pf-bg { min-height: 64px; border: 2px solid var(--line); border-radius: 10px; display: flex; align-items: flex-end; justify-content: center; padding: 4px; font-size: 12px; background-color: var(--panel); }
.pf-bg span { background: var(--panel); border-radius: 6px; padding: 1px 6px; }
.pf-bg.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.pf-bg.is-default { border-style: dashed; align-items: center; }
/* Settings: the four sounds */
.st-sounds { display: grid; gap: 8px; }
.st-sound { display: grid; grid-template-columns: minmax(120px, 1fr) auto minmax(80px, 140px) auto; gap: 8px; align-items: center; }
.st-sound-name { font-weight: 600; }
.st-sound button { min-height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); padding: 0 10px; }
.st-quiet label { display: flex; gap: 6px; align-items: center; }
@container (max-width: 479px) {
  .st-sound { grid-template-columns: 1fr auto; }
  .st-sound input[type=range] { grid-column: 1; }
  .pf-name { font-size: 21px; }
  .mg-ava.is-big { width: 80px; height: 80px; font-size: 28px; }
}
/* an away message shows the spaces as typed (two after a period) */
.mg-awayline span, .pf-away-show { white-space: pre-wrap; }

/* ═══ Step 5, Built for Work (December 1, 2026) ═══ */
/* cards: a platform's own, and links to our own platforms */
.mg-card { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; width: 100%; min-width: 220px; max-width: 360px; text-align: left; margin: 4px 0 2px; padding: 9px 12px; border: 1px solid var(--line); border-left: 4px solid var(--tagc, #6b7280); border-radius: 10px; background: var(--panel); color: var(--ink); cursor: pointer; }
.mg-card b { grid-column: 1; font-size: 15px; overflow-wrap: anywhere; }
.mg-card-tag { grid-column: 1; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--tagc, var(--soft)); }
.mg-card-sub { grid-column: 1; font-size: 12px; color: var(--soft); }
.mg-card-go { grid-column: 2; grid-row: 1 / span 3; font-size: 13px; font-weight: 600; color: var(--accent); }
.mg-card.is-link b { font-size: 13px; font-weight: 600; }
.mg-card.is-off { cursor: default; opacity: .7; }
.mg-card:hover:not(.is-off) { border-color: var(--accent); }
.is-mine .mg-card { color: var(--ink); }
/* a to-do's bubble: a green edge and a tick box, so a glance down a conversation finds the asks */
.mg-bubble.is-todo { border-left: 4px solid var(--good); background: color-mix(in srgb, var(--good) 8%, var(--panel)); color: var(--ink); min-width: min(260px, 70vw); }
.is-mine .mg-bubble.is-todo { background: color-mix(in srgb, var(--good) 12%, var(--panel)); color: var(--ink); }
.td-b-top { display: flex; gap: 8px; align-items: flex-start; }
.td-b-mark { color: var(--good); font-size: 18px; line-height: 1.2; }
.td-b-words { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.35; }
.mg-bubble.is-done .td-b-words { text-decoration: line-through; opacity: .7; }
.td-b-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 6px 0 2px; font-size: 12px; color: var(--soft); }
.td-due { font-weight: 600; }
.td-due.is-late { color: #c0392b; }
.td-b-state { font-size: 12px; color: var(--soft); margin: 4px 0; }
.td-custody { border: 0; background: none; padding: 0; color: inherit; text-align: left; text-decoration: underline dotted; cursor: pointer; font: inherit; }
.td-b-btns { display: flex; gap: 8px; margin-top: 6px; }
.td-b-btns button { min-height: 44px; flex: 1; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 600; padding: 0 12px; }
.td-b-btns .td-done { border-color: var(--good); color: var(--good); }
.td-b-btns .td-done.is-on { background: var(--good); color: #fff; }
.td-b-btns .td-got.is-on { opacity: .75; }
/* the to-do form, in place above the composer */
.mg-todoform { border-top: 1px solid var(--line); padding: 8px 10px; background: color-mix(in srgb, var(--good) 7%, var(--panel)); }
.td-f-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; color: var(--soft); }
.td-f-head b { color: var(--good); font-size: 14px; }
.td-f-head button { margin-left: auto; min-height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 0 10px; }
.td-f-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.td-f-row button, .td-f-date { min-height: 36px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); }
.td-f-row button small { color: var(--soft); font-size: 11px; }
.td-f-row .is-on { border-color: var(--good); background: var(--good); color: #fff; }
.td-f-row .is-on small { color: #fff; opacity: .85; }
.td-f-date input { border: 0; background: transparent; font: inherit; color: inherit; min-height: 30px; }
[data-todo-open].is-on { color: var(--good); }
/* My To-Dos and To-Dos I Sent */
.td-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); list-style: none; }
.td-tick { flex: none; width: 34px; height: 34px; margin: 14px 0 0 12px; border: 2px solid var(--good); border-radius: 8px; background: transparent; color: #fff; font-weight: 700; }
.td-row.is-done .td-tick { background: var(--good); }
.td-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; text-align: left; border: 0; background: transparent; padding: 10px 14px; color: var(--ink); }
.td-words { font-weight: 600; overflow-wrap: anywhere; }
.td-row.is-done .td-words { text-decoration: line-through; opacity: .65; }
.td-sub { font-size: 13px; color: var(--soft); }
.td-state { font-size: 12px; font-weight: 600; color: var(--good); }
.td-row.is-unseen .td-state { color: var(--warn); }
/* a platform's card waiting to be sent, and Call */
.mg-cardline { display: flex; gap: 10px; align-items: center; padding: 8px 14px; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); border-bottom: 1px solid var(--line); font-size: 14px; }
.mg-cardline span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mg-cardline button { min-height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 0 10px; }
.mg-head-call { flex: none; min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink); padding: 0 10px; white-space: nowrap; }
.mg-menu-items .is-quiet { color: var(--soft); font-size: 13px; }
/* custody */
.cu-words { font-weight: 700; font-size: 17px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cu-words.is-quiet { font-weight: 400; color: var(--soft); font-size: 14px; }
.cu-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0; font-size: 14px; }
.cu-facts dt { color: var(--soft); }
.cu-facts dd { margin: 0; }
.cu-lines { padding-left: 0; list-style: none; margin: 8px 0; border-top: 1px solid var(--line); }
.cu-lines li { display: grid; grid-template-columns: minmax(150px, max-content) 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cu-at { color: var(--soft); font-variant-numeric: tabular-nums; }
.cu-say, .cu-note { white-space: pre-wrap; }
.cu-note { color: var(--soft); font-size: 12px; }
.sh-head-btns { display: flex; gap: 6px; }
.cu-page { max-width: 760px; margin: 0 auto; padding: 24px; background: var(--panel); min-height: 100vh; }
.cu-print-head { display: flex; gap: 8px; align-items: center; }
.cu-print-head h1 { margin: 0; font-size: 22px; }
.cu-print-head button { min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 0 12px; }
.cu-brand { color: var(--soft); font-size: 13px; white-space: pre-wrap; }
@media print { .cu-print-head button { display: none; } .cu-page { padding: 0; } body { background: #fff; } }
/* Delivery */
.dv-filters { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 8px 0; font-size: 14px; }
.dv-filters input[type=date], .dv-filters select { min-height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--bg); color: inherit; font: inherit; }
.dv-filters .sh-check { margin-top: 0; }
.dv-tabs { display: flex; align-items: center; }
.dv-export { min-height: 34px; display: inline-flex; align-items: center; border: 1px solid var(--accent); color: var(--accent); border-radius: 8px; padding: 0 12px; font-weight: 600; text-decoration: none; }
.dv-wrap { overflow-x: auto; max-width: 100%; }
.dv-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.dv-table th, .dv-table td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.dv-table th { color: var(--soft); font-weight: 600; white-space: nowrap; }
.dv-table td:first-child { white-space: nowrap; }
.dv-table tr.is-gone { opacity: .6; }
.dv-table button { min-height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 0 8px; }
.dv-recs { margin: 0; padding: 0; list-style: none; }
.dv-recs li { white-space: nowrap; }
.dv-miss { color: #c0392b; font-weight: 600; }
.cu-print-head .spacer, .dv-tabs .spacer { flex: 1; }

/* ═══ Step 6, SOC: the roster on top of a roster team's chat, and alerts ═══ */
.mg-roster { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 6px 14px; border-bottom: 1px solid var(--line); background: var(--panel); font-size: 13px; }
.ro-mine { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.ro-btn { min-height: 32px; border: 0; background: transparent; color: var(--ink); padding: 0 12px; font-size: 13px; font-weight: 600; }
.ro-btn + .ro-btn { border-left: 1px solid var(--line); }
.ro-btn.is-on { color: #fff; background: var(--good); }
.ro-btn.st-available.is-on { background: var(--accent); }
.ro-btn.st-off.is-on { background: var(--soft); }
.ro-list { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; color: var(--soft); }
.ro-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--soft); margin-left: 4px; }
.ro-who { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--ink); }
.ro-who::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--soft); }
.ro-who.st-on::before { background: var(--good); }
.ro-who.st-available::before { background: var(--accent); }
.ro-none, .ro-off { font-style: italic; }
.mg-alert-open.is-on { color: #c0392b; }
.al-sev.is-critical.is-on { background: #c0392b; border-color: #c0392b; }
.al-sev.is-high.is-on { background: var(--warn); border-color: var(--warn); }
.al-sev.is-medium.is-on { background: #8a6d00; border-color: #8a6d00; }
.al-sev.is-low.is-on { background: var(--soft); border-color: var(--soft); }
.al-note { margin: 6px 0 0; font-size: 12px; color: #c0392b; }
.al-b { border-left: 4px solid var(--soft); padding-left: 10px; }
.al-b.is-critical { border-left-color: #c0392b; }
.al-b.is-high { border-left-color: var(--warn); }
.al-b.is-medium { border-left-color: #8a6d00; }
.al-badge { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; color: #fff; background: var(--soft); margin-right: 6px; vertical-align: 1px; }
.al-badge.is-critical { background: #c0392b; }
.al-badge.is-high { background: var(--warn); }
.al-badge.is-medium { background: #8a6d00; }
.td-b-btns .al-claim { border-color: #c0392b; background: #c0392b; color: #fff; }
/* On a phone the composer has no room for a fifth button: Alert moves into the + menu */
@container (max-width: 479px) { .mg-alert-open { display: none; } }
