/* messages.css — the messages component (messages.js), on admin.html and
   account.html. Its own tokens on .nmm, with a dark set, so it looks the
   same on both pages whatever else they load. */
.nmm {
  --nmm-bg: #ffffff;
  --nmm-soft: #f5f8f6;
  --nmm-line: rgba(15, 52, 44, 0.14);
  --nmm-ink: #1f2937;
  --nmm-muted: #5b6472;
  --nmm-brand: #1a3c34;
  --nmm-accent: #228b22;
  --nmm-accent-ink: #ffffff;
  --nmm-mine: #eef7f0;
  --nmm-team: #f1f5fb;
  --nmm-bad: #b91c1c;
  --nmm-tag: #e7f3ea;
  --nmm-tag-ink: #14532d;
  color: var(--nmm-ink);
  font-size: 14px;
}
[data-theme='dark'] .nmm {
  --nmm-bg: #111827;
  --nmm-soft: #1a2333;
  --nmm-line: rgba(255, 255, 255, 0.12);
  --nmm-ink: #e5e7eb;
  --nmm-muted: #9aa8bd;
  --nmm-brand: #6ee7b7;
  --nmm-accent: #16a34a;
  --nmm-mine: #13281f;
  --nmm-team: #172235;
  --nmm-bad: #f87171;
  --nmm-tag: rgba(74, 222, 128, 0.16);
  --nmm-tag-ink: #bbf7d0;
}
.nmm *, .nmm *::before, .nmm *::after { box-sizing: border-box; }
.nmm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.nmm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.nmm-lead { flex: 1 1 280px; margin: 0; color: var(--nmm-muted); line-height: 1.45; }
.nmm-filters { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 10px; background: var(--nmm-soft); }
.nmm-filter {
  border: 0; background: transparent; color: var(--nmm-muted); font: inherit; font-weight: 600; font-size: 13px;
  padding: 6px 11px; border-radius: 8px; cursor: pointer; min-height: 32px;
}
.nmm-filter[aria-selected='true'] { background: var(--nmm-bg); color: var(--nmm-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.nmm-count:not(:empty) { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--nmm-accent); color: var(--nmm-accent-ink); font-size: 11px; line-height: 18px; text-align: center; }
.nmm-search {
  flex: 1 1 200px; min-width: 0; min-height: 36px; padding: 6px 10px; border-radius: 9px;
  border: 1px solid var(--nmm-line); background: var(--nmm-bg); color: var(--nmm-ink); font: inherit;
}
.nmm-new, .nmm-send {
  margin-left: auto; min-height: 38px; padding: 0 16px; border: 0; border-radius: 9px;
  background: var(--nmm-accent); color: var(--nmm-accent-ink); font: inherit; font-weight: 700; cursor: pointer;
}
.nmm-send { margin-left: 0; }
.nmm-new:hover, .nmm-send:hover { filter: brightness(0.94); }
.nmm-send:disabled { opacity: 0.6; cursor: progress; }
.nmm-ghost {
  min-height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--nmm-line);
  background: transparent; color: var(--nmm-ink); font: inherit; font-weight: 600; cursor: pointer;
}

.nmm-body {
  display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  border: 1px solid var(--nmm-line); border-radius: 14px; overflow: hidden; background: var(--nmm-bg);
  min-height: 460px;
}
.nmm-list { border-right: 1px solid var(--nmm-line); overflow-y: auto; max-height: 70vh; background: var(--nmm-soft); }
.nmm-empty { margin: 0; padding: 18px; color: var(--nmm-muted); }
.nmm-row {
  display: grid; gap: 2px; width: 100%; text-align: left; padding: 11px 14px; border: 0;
  border-bottom: 1px solid var(--nmm-line); background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.nmm-row:hover { background: rgba(34, 139, 34, 0.06); }
.nmm-row.is-open { background: var(--nmm-bg); box-shadow: inset 3px 0 0 var(--nmm-accent); }
.nmm-row-top { display: flex; gap: 8px; align-items: baseline; }
.nmm-subj { flex: 1 1 auto; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nmm-row.is-unread .nmm-subj { font-weight: 800; }
.nmm-row time { flex: 0 0 auto; font-size: 12px; color: var(--nmm-muted); font-variant-numeric: tabular-nums; }
.nmm-row-who { font-size: 12.5px; color: var(--nmm-muted); }
.nmm-role { text-transform: capitalize; }
.nmm-row-prev { font-size: 12.5px; color: var(--nmm-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nmm-row-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.nmm-row-tags:empty { display: none; }
.nmm-tag { display: inline-block; padding: 1px 7px; border-radius: 999px; background: var(--nmm-soft); border: 1px solid var(--nmm-line); font-size: 11px; font-weight: 700; color: var(--nmm-muted); }
.nmm-tag-new { background: var(--nmm-accent); border-color: var(--nmm-accent); color: var(--nmm-accent-ink); }
.nmm-tag-closed { background: transparent; }

.nmm-pane { display: flex; flex-direction: column; min-width: 0; max-height: 70vh; overflow: hidden; }
.nmm-placeholder { margin: auto; padding: 40px 20px; text-align: center; color: var(--nmm-muted); display: grid; gap: 4px; }
.nmm-placeholder b { color: var(--nmm-ink); font-size: 15px; }
.nmm-thead { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--nmm-line); }
.nmm-thead-main { flex: 1 1 auto; min-width: 0; }
.nmm-thead h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--nmm-brand); overflow-wrap: anywhere; }
.nmm-thead p { margin: 2px 0 0; font-size: 12.5px; color: var(--nmm-muted); }
.nmm-thead a { color: inherit; }
.nmm-back { display: none; border: 0; background: transparent; color: var(--nmm-accent); font: inherit; font-weight: 700; cursor: pointer; padding: 4px 0; min-height: 32px; }

.nmm-posts { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px; display: grid; gap: 10px; align-content: start; }
.nmm-post { max-width: 88%; padding: 10px 13px; border-radius: 12px; border: 1px solid var(--nmm-line); background: var(--nmm-bg); }
.nmm-post.is-team { background: var(--nmm-team); }
.nmm-post.is-mine { margin-left: auto; background: var(--nmm-mine); }
.nmm-post header { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; margin-bottom: 4px; font-size: 12.5px; }
.nmm-post header time { color: var(--nmm-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nmm-text { line-height: 1.5; overflow-wrap: anywhere; }
.nmm-text a { color: var(--nmm-accent); }
.nmm-files { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.nmm-file { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; border: 1px solid var(--nmm-line); background: var(--nmm-bg); }
.nmm-thumb img { display: block; width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.nmm-ficon { flex: 0 0 44px; height: 44px; display: grid; place-items: center; border-radius: 6px; background: var(--nmm-soft); font-size: 11px; font-weight: 800; color: var(--nmm-brand); }
.nmm-fname { flex: 1 1 auto; min-width: 0; }
.nmm-fname b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nmm-fname small { color: var(--nmm-muted); font-size: 11.5px; }
.nmm-fact { display: flex; gap: 6px; flex: 0 0 auto; }
.nmm-fact a {
  display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--nmm-line); color: var(--nmm-ink); text-decoration: none; font-weight: 700; font-size: 12.5px;
}
.nmm-fact a[download] { background: var(--nmm-accent); border-color: var(--nmm-accent); color: var(--nmm-accent-ink); }

.nmm-form { display: grid; gap: 10px; }
.nmm-reply { border-top: 1px solid var(--nmm-line); padding: 12px 16px; }
.nmm-compose { padding: 0 0 16px; overflow-y: auto; }
.nmm-compose > :not(.nmm-thead) { margin-left: 16px; margin-right: 16px; }
.nmm-form.is-drop { outline: 2px dashed var(--nmm-accent); outline-offset: -4px; }
.nmm-field { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.nmm-field input, .nmm-form textarea {
  width: 100%; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--nmm-line);
  background: var(--nmm-bg); color: var(--nmm-ink); font: inherit; font-weight: 400; resize: vertical;
}
.nmm-to-fixed { margin-top: 12px !important; color: var(--nmm-muted); }
.nmm-suggest { display: grid; gap: 4px; }
.nmm-suggest:empty { display: none; }
.nmm-opt { display: grid; text-align: left; gap: 1px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--nmm-line); background: var(--nmm-soft); color: inherit; font: inherit; cursor: pointer; }
.nmm-opt small { color: var(--nmm-muted); }
.nmm-attach { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.nmm-attach-btn {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--nmm-line); font-weight: 700; font-size: 13px; cursor: pointer;
}
.nmm-attach-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.nmm-attach-btn:focus-within { outline: 2px solid var(--nmm-accent); outline-offset: 1px; }
.nmm-hint { font-size: 12px; color: var(--nmm-muted); margin: 0; }
.nmm-chosen { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.nmm-chosen:empty { display: none; }
.nmm-chosen li { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--nmm-tag); color: var(--nmm-tag-ink); font-size: 12.5px; max-width: 100%; }
.nmm-chosen li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.nmm-chosen button { width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 16px; cursor: pointer; }
.nmm-progress { width: 100%; height: 4px; border-radius: 2px; background: var(--nmm-soft); overflow: hidden; }
.nmm-progress > div { height: 100%; width: 0; background: var(--nmm-accent); transition: width 0.15s; }
.nmm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.nmm-status { font-size: 13px; font-weight: 600; color: var(--nmm-muted); }
.nmm-status.is-bad { color: var(--nmm-bad); }
.nmm-keys { margin-left: auto; }

@media (max-width: 760px) {
  .nmm-body { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .nmm-list { border-right: 0; max-height: none; }
  .nmm-pane { display: none; max-height: none; }
  .nmm.is-reading .nmm-list { display: none; }
  .nmm.is-reading .nmm-pane { display: flex; }
  .nmm-back { display: inline-flex; }
  .nmm-posts { max-height: 60vh; }
  .nmm-post { max-width: 100%; }
  .nmm-new { margin-left: 0; }
  .nmm-keys { display: none; }
  .nmm-file { flex-wrap: wrap; }
  .nmm-fact { width: 100%; justify-content: flex-end; }
}
@media (pointer: coarse) {
  .nmm-filter, .nmm-ghost, .nmm-attach-btn, .nmm-fact a { min-height: 36px; }
}
