/* メール配信 control plane 管理パネル。プレフィックス: .mail- */

.mail-wrap {
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.mail-head {
  margin-bottom: 24px;
}

.mail-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
}

.mail-desc {
  color: var(--text-muted, #6b7280);
  font-size: 14px;
  margin: 0;
  line-height: 1.6;
}

.mail-panel {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.mail-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.mail-h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.mail-hint {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  margin: 0 0 12px;
  line-height: 1.6;
}

.mail-hint code,
.mail-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  word-break: break-all;
}

.mail-list {
  overflow-x: auto;
}

.mail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.mail-table th,
.mail-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  vertical-align: top;
}

.mail-table th {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  font-weight: 600;
}

.mail-row-actions {
  white-space: nowrap;
  text-align: right;
}

.mail-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted, #6b7280);
  font-size: 14px;
}

.mail-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.mail-badge-prod {
  background: #dcfce7;
  color: #166534;
}

.mail-badge-sandbox {
  background: #fef9c3;
  color: #854d0e;
}

.mail-btn {
  border: 1px solid var(--border, #d1d5db);
  background: var(--card-bg, #fff);
  color: var(--text, #111827);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.mail-btn:hover {
  background: var(--hover-bg, #f3f4f6);
}

.mail-btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.mail-btn-primary:hover {
  background: #1d4ed8;
}

.mail-btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.mail-btn-danger {
  color: #b91c1c;
  border-color: #fecaca;
}

.mail-btn-danger:hover {
  background: #fef2f2;
}

/* ===== モーダル ===== */

.mail-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.mail-modal {
  background: var(--card-bg, #fff);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.mail-modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px;
}

.mail-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 13px;
}

.mail-field > span {
  color: var(--text-muted, #6b7280);
  font-weight: 600;
}

.mail-field input[type='text'],
.mail-field input[type='number'],
.mail-field select,
.mail-field textarea {
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--input-bg, #fff);
  color: var(--text, #111827);
  width: 100%;
  box-sizing: border-box;
}

.mail-field textarea {
  resize: vertical;
}

.mail-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.mail-check input {
  width: auto;
}

.mail-field-row {
  display: flex;
  gap: 12px;
}

.mail-field-row .mail-field {
  flex: 1;
}

.mail-modal-err {
  color: #b91c1c;
  font-size: 13px;
  margin: 4px 0 12px;
}

.mail-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* ===== トースト ===== */

.mail-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.mail-toast-error {
  background: #b91c1c;
}

@media (prefers-color-scheme: dark) {
  .mail-badge-prod {
    background: #14532d;
    color: #bbf7d0;
  }
  .mail-badge-sandbox {
    background: #713f12;
    color: #fef08a;
  }
}
