dialog.friend-mail {
  width: min(460px, calc(100vw - 24px)); max-width: none; padding: 0; color: var(--ink);
  border: 1px solid #9ebbc4; border-radius: 4px; background: #f5f9f9; box-shadow: 0 12px 48px #16384538;
}
.friend-mail[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; height: min(610px, 85dvh); max-height: 100dvh; }
.friend-mail::backdrop { background: #1e3d4b66; backdrop-filter: blur(4px); }
.friend-mail [hidden] { display: none !important; }
.mail-head { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 10px 14px; background: #e9f1f2; border-bottom: 1px solid #c2d6db; }
.mail-head h2 { flex: 1; margin: 0; font: 680 1.4rem/1.25 system-ui,sans-serif; letter-spacing: -.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-control { background: transparent; border: none; font-size: 1.6rem; width: 42px; height: 42px; color: #2b535d; }
.mail-list,.mail-history { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; min-height: 0; }
.mail-person { display: flex; align-items: center; width: 100%; gap: 12px; padding: 14px 18px; color: inherit; background: transparent; text-align: left; border: none; border-bottom: 1px solid #d6e3e6; }
.mail-person:is(:hover,:focus-visible) { background: #e3eff0; }
.mail-monogram { flex: 0 0 36px; height: 36px; display: grid; place-items: center; font-size: 1.1rem; font-weight: 700; border-radius: 50%; background: #d8e7e4; color: #375d56; }
.mail-summary { flex: 1; min-width: 0; display: grid; gap: 2px; }
.mail-summary strong,.mail-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-meta { display: grid; justify-items: end; gap: 3px; }
.mail-preview,.mail-meta time { color: #516770; font-size: .85rem; }
.mail-unread { border-radius: 12px; min-width: 20px; text-align: center; color: white; background: #8b394a; font-size: .76rem; font-weight: bold; }
.mail-empty { padding: 26px 20px; }
.mail-log { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px 20px; }
.mail-line { align-self: flex-start; max-width: 88%; }
.mail-line.mine { align-self: flex-end; }
.friend-mail .mail-body { color: #243e46; background: #e3ebec; border-radius: 2px 9px 9px 9px; margin: 0; padding: 8px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.friend-mail .mine .mail-body { background: #d1e9e4; border-radius: 9px 2px 9px 9px; }
.mail-line time { display: block; font-size: .7rem; color: #5a6b71; margin: 2px 3px 0; }
.mail-line.mine time { text-align: right; }
.mail-day,.mail-first { text-align: center; font-size: .85rem; }
.mail-day { font-weight: 650; }
.mail-earlier { display: block; margin: 8px auto; border: 0; background: transparent; color: #285866; text-decoration: underline; min-height: 36px; }
.friend-mail .mail-status { margin: 0; padding: 6px 14px; font-size: .86rem; }
.mail-compose { display: flex; gap: 8px; align-items: center; padding: 10px 12px max(10px,env(safe-area-inset-bottom)); background: #edf4f3; border-top: 1px solid #c6d9dc; }
.mail-compose textarea { flex: 1; min-width: 0; min-height: 48px; max-height: 110px; border: 1px solid #9cb9bf; border-radius: 3px; padding: 8px; resize: vertical; color: var(--ink); background: white; }
@media (max-width: 540px) { .friend-mail[open] { margin: auto 0 0; width: 100%; height: min(640px,92dvh); border-radius: 5px 5px 0 0; } }
