/* 메일 작성 수신자 칩 입력 (2026-08-12) — email_recipient_chips_controller 와 짝.
 * 받는사람/참조/숨은참조 공용. hidden store 가 실값(쉼표 문자열)이고 칩은 표현.
 */

.erc-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 38px;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  cursor: text;
  box-sizing: border-box;
}

.erc-box:focus-within {
  border-color: #3e6187;
  box-shadow: 0 0 0 2px rgba(62, 97, 135, 0.12);
}

.erc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 3px 4px 3px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f1f5f9;
  font-size: 12px;
  color: #334155;
  line-height: 1.3;
  user-select: none;
}

.erc-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

/* 형식 오류 — 빨간 표시, 발송은 컨트롤러가 차단 */
.erc-chip-invalid {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
}

.erc-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #64748b;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.erc-chip-x:hover { background: #e2e8f0; color: #0f172a; }
.erc-chip-invalid .erc-chip-x { color: #b91c1c; }
.erc-chip-invalid .erc-chip-x:hover { background: #fee2e2; }

/* 칩 필드 래퍼 — 자동완성 드롭다운의 기준 좌표 */
.erc-field { position: relative; }

/* ⚠고특이성 + !important — 내부 입력칸이 별도 입력칸처럼 보이면 안 된다.
 * 전역/UA 의 input 테두리·포커스 링이 무엇이든 이겨서 박스에 녹아들게 고정 (실사고: 파란 포커스 링). */
.erc-box input.erc-input,
.erc-box input.erc-input:focus,
.erc-box input.erc-input:focus-visible {
  flex: 1;
  min-width: 140px;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-size: 13px;
  padding: 4px 2px;
  background: transparent !important;
  color: #0f172a;
  border-radius: 0;
}

/* ============ 입력 중 자동완성 (주소록) ============ */

.erc-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30; /* 모달 스태킹 컨텍스트 내부 — 모달 z-index 와 무관 */
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
  max-height: 240px;
  overflow-y: auto;
}

.erc-suggest-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12.5px;
  border-bottom: 1px solid #f8fafc;
}

.erc-suggest-item:last-child { border-bottom: none; }

.erc-suggest-item:hover,
.erc-suggest-item.is-active { background: #eef2ff; }

.erc-suggest-name {
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.erc-suggest-fav { color: #f59e0b; font-size: 11px; }

.erc-suggest-email {
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.erc-suggest-org {
  color: #94a3b8;
  font-size: 11px;
  white-space: nowrap;
}

/* ============ 주소록 선택 모달 (email_contact_picker_controller) ============ */

.ecp-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 16px 10px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.ecp-search {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  box-sizing: border-box;
  background: #fff;
}

.ecp-group-select {
  width: 150px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12.5px;
  background: #fff;
}

.ecp-list-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12px;
  color: #64748b;
}

.ecp-list {
  overflow-y: auto;
  max-height: 48vh;
  min-height: 180px;
}

.ecp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid #f8fafc;
  cursor: pointer;
}

.ecp-row:hover { background: #f8fafc; }

.ecp-row.ecp-row-disabled {
  cursor: default;
  opacity: 0.55;
  background: #fafafa;
}

.ecp-row-main { flex: 1; min-width: 0; }

.ecp-row-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ecp-row-fav { color: #f59e0b; font-size: 12px; }

.ecp-row-email {
  font-size: 12px;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ecp-row-sub {
  font-size: 11px;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ecp-row-group {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.ecp-row-added {
  flex-shrink: 0;
  font-size: 11px;
  color: #16a34a;
  font-weight: 700;
  white-space: nowrap;
}

.ecp-empty {
  padding: 36px 16px;
  text-align: center;
  font-size: 13px;
  color: #94a3b8;
}

.ecp-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid #e5e7eb;
  background: #f8fafc;
}

.ecp-count {
  flex: 1;
  font-size: 12.5px;
  color: #475569;
  font-weight: 600;
}

.ecp-add-btn {
  padding: 7px 14px;
  border: 1px solid #3e6187;
  border-radius: 6px;
  background: #3e6187;
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.ecp-add-btn:hover { background: #345373; }

.ecp-add-btn.ecp-add-secondary {
  background: #fff;
  color: #3e6187;
}

.ecp-add-btn.ecp-add-secondary:hover { background: #f0f5fa; }

.ecp-add-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 작성 모달의 「주소록」 진입 버튼 */
.erc-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.erc-picker-btn:hover { background: #e0e7ff; }
