/* CV Mojo app (v2): Messages (/messages). Classes are prefixed mg-; shared pieces
   (ap-*, db-*, cvm-*) come from app.css. The sidebar's count badge (.side-count) is in app.css. */

.mg [hidden] { display: none !important; }


/* Dashboard nudge */
.mg-nudge { margin-top: -6px; }
.db-av.mg-nudge-ic { color: var(--navy); background: var(--yellow); }

/* Notes about the portfolio (unpublished, contact form off) */
.mg-note { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 12px 16px; font-size: 14.5px; font-weight: 600; color: var(--amber); background: var(--amber-soft); border-radius: 14px; }
.mg-note svg { flex: none; margin-top: 2px; }
.mg-note a { font-weight: 800; color: var(--navy); }
#mgNote:empty { display: none; }

/* Two panes: the list and the message */
.mg-grid { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.mg-list { padding: 8px; }
.mg-rows { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.mg-row { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 12px; font: inherit; text-align: left; color: var(--text); background: none; border: 0; border-radius: 14px; cursor: pointer; transition: background-color .15s ease; }
.mg-row:hover { background: var(--mist); }
.mg-row:focus-visible { outline: 3px solid var(--indigo); outline-offset: -3px; }
.mg-row.is-active { background: var(--channel-soft); }
.mg-row-main { display: grid; flex: 1; gap: 1px; min-width: 0; }
.mg-row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.mg-row-top b { overflow: hidden; font-size: 15px; font-weight: 600; color: var(--navy); white-space: nowrap; text-overflow: ellipsis; }
.mg-row-top time { flex: none; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.mg-row-co { overflow: hidden; font-size: 13px; font-weight: 600; color: var(--indigo); white-space: nowrap; text-overflow: ellipsis; }
.mg-row-snip { display: -webkit-box; overflow: hidden; font-size: 13.5px; line-height: 1.45; color: var(--muted); -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mg-row.is-unread .mg-row-top b { font-weight: 800; }
.mg-row.is-unread .mg-row-snip { color: var(--text); font-weight: 600; }
.mg-dot { flex: none; width: 10px; height: 10px; margin-top: 6px; background: var(--indigo); border-radius: 50%; box-shadow: 0 0 0 4px rgba(39, 52, 159, .12); }
.mg-av { width: 40px; height: 40px; font-size: 15px; }
.mg-av--lg { width: 52px; height: 52px; font-size: 19px; }

.mg-read { min-height: 360px; }
.mg-pick { display: grid; place-items: center; align-content: center; gap: 10px; min-height: 300px; color: var(--muted); text-align: center; }
.mg-pick p { margin: 0; font-weight: 600; }
.mg-back { display: none; align-items: center; gap: 6px; margin: 0 0 14px; padding: 6px 0; font: inherit; font-size: 14px; font-weight: 700; color: var(--indigo); background: none; border: 0; cursor: pointer; }
.mg-msg-head { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.mg-msg-who { min-width: 0; }
.mg-msg-who h2 { margin: 0; font-size: 1.35rem; font-weight: 800; line-height: 1.25; color: var(--navy); overflow-wrap: anywhere; }
.mg-msg-who h2:focus { outline: none; }
.mg-msg-who p { margin: 2px 0 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.mg-msg-body { margin: 18px 0 0; font-size: 15.5px; line-height: 1.65; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.mg-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.mg .btn svg { flex: none; }
.mg-del { color: #b42318; }
.mg-del:hover { color: #b42318; background: #fdecea; }
.mg-reply, .mg-confirm { margin-top: 16px; padding: 16px 18px; border-radius: 16px; }
.mg-reply { display: grid; justify-items: start; gap: 12px; background: var(--mist); }
.mg-reply p, .mg-confirm p { margin: 0; font-size: 14.5px; color: var(--text); }
.mg-email { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mg-email-addr { padding: 8px 14px; font-size: 15px; font-weight: 700; color: var(--navy); background: #fff; border: 1.5px solid var(--line); border-radius: 12px; overflow-wrap: anywhere; user-select: all; }
.mg-copy { min-height: 38px; padding: 6px 14px; }
.mg-confirm { background: #fdecea; }
.mg-confirm-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.mg-del-yes { color: #fff; background: #b42318; }
.mg-del-yes:hover { color: #fff; background: #912018; }
.mg-safe { display: flex; align-items: flex-start; gap: 8px; margin: 20px 0 0; font-size: 13px; color: var(--muted); }
.mg-safe svg { flex: none; margin-top: 2px; }

@media (max-width: 900px) {
  .mg-grid { grid-template-columns: minmax(0, 1fr); }
  .mg-grid .mg-read { display: none; }
  .mg-grid.is-reading .mg-list { display: none; }
  .mg-grid.is-reading .mg-read { display: block; }
  .mg-back { display: inline-flex; }
}
@media (max-width: 560px) {
  .mg-actions .btn { flex: 1 1 auto; }
  .mg-read { min-height: 0; }
}
