/*
 * 이메일 모달 — A-4 액센트형 (2026-08-22, 사용자 확정 시안 sample/test2/email/) — .emx-*
 * 게시글 상세(.bpm-*)와 같은 문법: 브랜드 밴드·제목 액센트 바·아바타·브랜드 틴트 카드.
 * ⚠.eml-* 은 그룹 피커가 선점한 접두어 — 여기는 .emx-* 만 쓴다.
 * ⚠읽은시각(read_state)·그룹(group_row) 파셜은 turbo_stream 교체 단위라 구조 불변 —
 *   정보 카드가 종전과 같은 2열 그리드(display:contents 계약)를 유지한다.
 */

/* ── 헤더 밴드 ── */
.emx-band { background: linear-gradient(180deg, #f3f7fb, #fff); padding: 16px 20px 14px; border-bottom: 1px solid #e2e8f0; flex-shrink: 0; }
.emx-badges { display: flex; gap: 6px; margin-bottom: 9px; flex-wrap: wrap; }
.emx-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.emx-badge--out { background: #3e6187; color: #fff; }
.emx-badge--in { background: #0d9488; color: #fff; }
.emx-badge--self { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }
.emx-badge--trash { background: #fee2e2; color: #b91c1c; }
.emx-title { font-size: 18px; font-weight: 800; color: #0f172a; line-height: 1.35; padding-left: 12px; border-left: 4px solid #3e6187; margin: 0 0 12px; letter-spacing: -.2px; word-break: break-all; }
.emx-meta { display: flex; align-items: center; gap: 11px; }
.emx-avatar { width: 38px; height: 38px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.emx-avatar--out { background: linear-gradient(135deg, #3e6187, #5b82ab); box-shadow: 0 2px 6px rgba(62, 97, 135, .3); }
.emx-avatar--in { background: linear-gradient(135deg, #0d9488, #2dd4bf); box-shadow: 0 2px 6px rgba(13, 148, 136, .3); }
.emx-who { flex: 1; min-width: 0; }
.emx-name { font-size: 14px; font-weight: 700; color: #1e293b; word-break: break-all; }
.emx-name .emx-addr { font-weight: 400; color: #94a3b8; font-size: 12px; margin-left: 5px; }
.emx-sub { font-size: 12px; color: #94a3b8; margin-top: 2px; }

/* ── 본문 래퍼 (상세 모달 — 종전 flex 계약 유지: iframe 이 남은 높이 전부) ── */
.emx-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 13px; padding: 14px 20px 18px; box-sizing: border-box; }

/* ── 정보 카드 (받는이·참조·읽은시각·그룹·상태 — 2열 그리드 = 파셜 display:contents 계약) ── */
.emx-info { border: 1px solid #dbe6f0; border-radius: 12px; padding: 12px 15px; display: grid; grid-template-columns: 80px 1fr; gap: 7px 12px; font-size: 12.5px; flex-shrink: 0; }
.emx-info .emx-k { color: #64748b; font-weight: 700; }
.emx-info .emx-v { color: #0f172a; word-break: break-all; }

/* ── 브랜드 틴트 카드 공통 (수신자·첨부) ── */
.emx-card { border: 1px solid #dbe6f0; border-radius: 12px; overflow: hidden; flex-shrink: 0; }
.emx-card-hd { display: flex; align-items: center; font-size: 12px; font-weight: 700; color: #3e6187; background: #f3f7fb; padding: 9px 15px; border-bottom: 1px solid #dbe6f0; }
.emx-card-hd .emx-r { margin-left: auto; font-weight: 600; color: #7e97ae; font-size: 11.5px; }

/* 분리발송 수신자 토글 행 */
.emx-rcp-scroll { max-height: 240px; overflow: auto; }
.emx-rcp summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 9px 15px; cursor: pointer; font-size: 12.5px; }
.emx-rcp summary::-webkit-details-marker { display: none; }
.emx-rcp summary::before { content: "▸"; color: #94a3b8; font-size: 10px; transition: transform .15s; flex-shrink: 0; }
.emx-rcp[open] summary::before { transform: rotate(90deg); }
.emx-rcp summary:hover { background: #f8fbfd; }
.emx-rcp + .emx-rcp { border-top: 1px solid #eef4f9; }
.emx-rcp .emx-rcp-addr { flex: 1; min-width: 0; color: #0f172a; word-break: break-all; }
.emx-rcp .emx-rcp-detail { padding: 5px 15px 11px 32px; background: #fafbfc; display: grid; grid-template-columns: 62px 1fr; gap: 4px 10px; font-size: 11.5px; color: #475569; }
.emx-rcp .emx-rcp-detail .emx-k { color: #64748b; font-weight: 700; }

/* 첨부 행 */
.emx-att { display: flex; align-items: center; gap: 12px; padding: 10px 15px; }
.emx-att + .emx-att { border-top: 1px solid #eef4f9; }
.emx-att:hover { background: #f8fbfd; }
.emx-att.is-rejected { background: #fef2f2; }
.emx-att .emx-att-nm { flex: 1; min-width: 0; font-size: 12.5px; color: #1e293b; font-weight: 500; word-break: break-all; }
.emx-att.is-rejected .emx-att-nm { color: #991b1b; }
.emx-att .emx-att-sz { font-size: 11.5px; color: #94a3b8; white-space: nowrap; }
.emx-att .emx-att-dl { flex-shrink: 0; font-size: 12px; color: #3e6187; border: 1.5px solid #3e6187; background: #fff; padding: 5px 13px; border-radius: 8px; text-decoration: none; font-weight: 700; transition: background .12s, color .12s; }
.emx-att .emx-att-dl:hover { background: #3e6187; color: #fff; }

/* ── 작성 폼 (compose) ── */
.emx-form { padding: 18px 22px; display: grid; gap: 14px; }
.emx-label { display: flex; align-items: center; font-size: 13px; font-weight: 700; color: #334155; margin-bottom: 6px; }
.emx-label .emx-req { color: #dc2626; margin-left: 3px; }
.emx-label .emx-side { margin-left: auto; display: flex; gap: 6px; }
.emx-sublabel { display: block; font-size: 11.5px; font-weight: 600; color: #475569; margin-bottom: 4px; }
.emx-input { width: 100%; padding: 10px 13px; border: 1.5px solid #c4d3e2; border-radius: 10px; font-size: 13.5px; font-family: inherit; color: #1e293b; background: #fcfdfe; box-sizing: border-box; }
.emx-form .emx-input:focus, .emx-form .emx-input:focus-visible { outline: none; border-color: #3e6187; box-shadow: 0 0 0 3px #3e618722; background: #fff; }
select.emx-input { cursor: pointer; }
/* 자유 입력 from (시스템 컨텍스트) — 도메인 접미 결합칸 */
.emx-fromjoin { display: flex; align-items: center; border: 1.5px solid #c4d3e2; border-radius: 10px; overflow: hidden; background: #fff; }
.emx-fromjoin:focus-within { border-color: #3e6187; box-shadow: 0 0 0 3px #3e618722; }
.emx-fromjoin input { flex: 1; padding: 10px 13px; border: none; outline: none; font-size: 13.5px; font-family: inherit; }
.emx-fromjoin .emx-domain { padding: 10px 13px; background: #f3f7fb; border-left: 1px solid #dbe6f0; color: #64748b; font-size: 13px; white-space: nowrap; }
/* 주소록·내게쓰기 — 라운드 칩 버튼 (아이콘 없음, 사용자 확정) */
.emx-chipbtn { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: #3e6187; background: #fff; border: 1.5px solid #c4d3e2; border-radius: 16px; padding: 4px 13px; cursor: pointer; }
.emx-chipbtn:hover { border-color: #3e6187; background: #f3f7fb; }
.emx-chipbtn.on { background: #3e6187; border-color: #3e6187; color: #fff; }
/* 칩 입력칸(.erc-box)의 A-4 톤 오버라이드 — 칩 위젯 동작·마크업은 불변 */
.emx-form .erc-box { border: 1.5px solid #c4d3e2 !important; border-radius: 10px !important; background: #fcfdfe !important; }
.emx-form .erc-field:focus-within .erc-box { border-color: #3e6187 !important; box-shadow: 0 0 0 3px #3e618722 !important; background: #fff !important; }
.emx-cc summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: #3e6187; padding: 2px 0; list-style: none; }
.emx-cc summary::-webkit-details-marker { display: none; }
.emx-cc summary::before { content: "▸ "; font-size: 11px; }
.emx-cc[open] summary::before { content: "▾ "; }
.emx-cc summary:hover { text-decoration: underline; }
.emx-hint { margin: 4px 0 0; font-size: 10.5px; color: #94a3b8; line-height: 1.5; }

/* compose 첨부 카드 */
.emx-fatts-body { padding: 12px 14px; }
.emx-filebtn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: #3e6187; border: 1.5px solid #3e6187; background: #fff; padding: 7px 15px; border-radius: 8px; cursor: pointer; }
.emx-filebtn:hover { background: #3e6187; color: #fff; }
.emx-fatts-hint { margin: 9px 0 0; font-size: 11px; color: #94a3b8; line-height: 1.55; }
.emx-fatts-hint b { color: #64748b; }
/* 재사용(원본) 첨부 칩 */
.emx-reuse { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px 5px 12px; background: #eef4f9; border: 1px solid #d5e2ee; border-radius: 999px; font-size: 12px; color: #1e3a53; font-weight: 600; }
.emx-reuse .emx-reuse-sz { color: #7e97ae; font-weight: 500; }
.emx-reuse button { border: none; background: transparent; color: #94a3b8; cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; }
.emx-reuse button:hover { color: #dc2626; }

@media (max-width: 640px) {
  .emx-band { padding: 13px 14px 12px; }
  .emx-body { padding: 12px 14px 16px; }
  .emx-form { padding: 14px; }
  .emx-title { font-size: 16px; }
  .emx-info { grid-template-columns: 68px 1fr; }
}
