.jtexa-mail-composer-modal {
/*
  System font stack:
  - Apple platforms: San Francisco / Hiragino Sans
  - Windows: Segoe UI / Yu Gothic / Meiryo
  - Korean fallback: Noto Sans KR / Malgun Gothic
  No webfont import is used so JP/KR/EN render quickly and consistently.
*/
  --app-font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Helvetica Neue", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-family: var(--app-font-family);
  font-weight: 400;
  letter-spacing: 0;
  -webkit-font-smoothing: auto;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
  position: fixed;
  inset: 0;
  z-index: 260;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
}

.jtexa-mail-composer-modal.is-open {
  display: flex;
}

.jtexa-mail-composer-dialog {
  width: min(960px, calc(100vw - 64px));
  min-height: min(780px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line, #d9e2f1);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
  padding: 18px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.jtexa-mail-composer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.jtexa-mail-composer-title {
  margin: 0;
  font-size: 25px;
  color: #17376e;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.jtexa-mail-composer-title i {
  font-size: 25px;
  color: #2758d8;
  line-height: 1;
}

.jtexa-mail-composer-close {
  min-width: 82px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid #b9ccf3;
  border-radius: 999px;
  background: #f3f7ff;
  color: #2758d8;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.jtexa-mail-composer-close:hover,
.jtexa-mail-composer-close:focus-visible {
  border-color: #2758d8;
  background: #e8efff;
  outline: none;
}

.jtexa-mail-composer-grid {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px 12px;
  align-items: center;
}

.jtexa-mail-composer-grid label {
  color: #506078;
  font-size: 14px;
  font-weight: 700;
}

.jtexa-mail-composer-modal .jtexa-mail-composer-field {
  width: 100%;
  min-height: 38px;
  border: 1px solid #c7d4ec;
  border-radius: 9px;
  padding: 0 12px;
  font-size: 15px;
  line-height: 1.45;
  color: #1f2937;
  background: #fff;
  font-family: inherit;
  box-sizing: border-box;
}

.jtexa-mail-composer-modal select.jtexa-mail-composer-field {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, #506078 50%),
    linear-gradient(135deg, #506078 50%, transparent 50%);
  background-position:
    calc(100% - 22px) 50%,
    calc(100% - 16px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.jtexa-mail-composer-modal select.jtexa-mail-composer-field::-ms-expand {
  display: none;
}

.jtexa-mail-composer-supplier,
.jtexa-mail-composer-recipient {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.jtexa-mail-composer-subject {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.jtexa-mail-composer-modal .jtexa-mail-composer-subject input {
  width: auto;
  min-width: 0;
  flex: 1 1 auto;
}

.jtexa-mail-composer-modal .jtexa-mail-composer-template-select {
  width: min(220px, 38%);
  min-width: 160px;
  flex: 0 0 auto;
}

.jtexa-mail-composer-supplier-select,
.jtexa-mail-composer-recipient-select {
  min-height: 34px;
}

.jtexa-mail-composer-modal .jtexa-mail-composer-body {
  min-height: 380px;
  padding: 14px 16px;
  resize: vertical;
}

.jtexa-mail-composer-attachments {
  grid-column: 2;
  display: none;
  grid-auto-flow: column;
  grid-auto-columns: 112px;
  gap: 4px;
  padding: 8px;
  border: 1px solid #d9e4f6;
  background: #f8fbff;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.jtexa-mail-composer-attachments.is-visible {
  display: grid;
}

.jtexa-mail-composer-attachment {
  position: relative;
  width: 112px;
  height: 112px;
  min-width: 0;
  overflow: hidden;
  background: #fff;
  scroll-snap-align: start;
}

.jtexa-mail-composer-attachment img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.jtexa-mail-composer-attachment button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.36);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  text-shadow: 0 1px 4px rgba(15, 23, 42, 0.45);
}

.jtexa-mail-composer-status {
  margin: 0;
  min-height: 18px;
  font-size: 13px;
  color: #5e6b82;
}

.jtexa-mail-composer-status.error {
  color: #b42318;
}

.jtexa-mail-composer-status.success {
  color: #067647;
}

.jtexa-mail-composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.jtexa-mail-composer-modal .jtexa-mail-composer-actions .btn {
  width: auto;
  min-width: 78px;
  min-height: 42px;
  height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 1;
}

.jtexa-mail-composer-modal .jtexa-mail-composer-actions .btn.primary {
  border-color: #2758d8;
  background: #2758d8;
  color: #fff;
}

@media (max-width: 720px) {
  .jtexa-mail-composer-modal {
    padding: 14px;
  }

  .jtexa-mail-composer-dialog {
    width: min(100%, calc(100vw - 28px));
    min-height: 0;
    max-height: calc(100vh - 28px);
  }

  .jtexa-mail-composer-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .jtexa-mail-composer-attachments {
    grid-column: 1;
  }

  .jtexa-mail-composer-subject {
    display: grid;
    gap: 6px;
  }

  .jtexa-mail-composer-modal .jtexa-mail-composer-template-select {
    width: 100%;
    min-width: 0;
  }
}
