* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background: #f4f5f7;
  color: #222;
  margin: 0;
}
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}
.card {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 16px;
}
h1 { font-size: 22px; }
h2 { font-size: 18px; }
header.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: #1b1f27;
  color: #fff;
}
header.topbar a { color: #fff; text-decoration: none; margin-right: 16px; }
header.topbar a:hover { text-decoration: underline; }
label { display: block; margin: 10px 0 4px; font-weight: 600; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}
button {
  background: #2d6cdf;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-right: 8px;
  margin-top: 8px;
}
button:hover { background: #1f56b8; }
button.secondary { background: #888; }
button.secondary:hover { background: #666; }
button.danger { background: #d9534f; }
button.danger:hover { background: #b52b27; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid #eee; font-size: 14px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f0f4ff; }
.error { color: #d9534f; font-size: 13px; margin-top: 8px; }
.tag {
  display: inline-flex;
  align-items: center;
  background: #eef2fb;
  border-radius: 12px;
  padding: 4px 10px;
  margin: 4px 6px 4px 0;
  font-size: 13px;
}
.tag button {
  background: none;
  color: #d9534f;
  padding: 0 0 0 8px;
  margin: 0;
  font-size: 14px;
}
.service-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.muted { color: #777; font-size: 13px; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 1000;
  overflow-y: auto;
}
.modal-box {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  max-width: 900px;
  width: 100%;
}
.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.preview-table input[type=number] { width: 90px; }
.result-ok { color: #2d7d2d; }
.result-fail { color: #d9534f; }

/* 除外国/含む国のチェックボックス選択UI */
.region-search {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}
.region-picker {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px 12px;
  background: #fafafa;
}
.region-group { margin-bottom: 6px; }
.region-group-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  margin-bottom: 2px;
  font-weight: normal;
}
.region-group-heading strong { font-size: 13px; }
.region-group-children {
  margin-left: 22px;
  display: flex;
  flex-direction: column;
}
.region-item {
  font-weight: normal;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 1px 0;
}

/* 一括編集ステッパー */
.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  background: #eee;
  color: #888;
}
.step-current { background: #2d6cdf; color: #fff; font-weight: 600; }
.step-done { background: #d7ead7; color: #2d7d2d; }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.15);
  font-size: 11px;
}
.step-sep { color: #bbb; }

.bulk-count-banner {
  font-size: 20px;
  font-weight: 700;
  background: #eef2fb;
  color: #1f3a6e;
  padding: 14px 18px;
  border-radius: 6px;
  margin-bottom: 16px;
  text-align: center;
}

.bulk-result-banner {
  font-size: 18px;
  font-weight: 700;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 12px;
  text-align: center;
}
.result-banner-ok { background: #d7ead7; color: #1e5e1e; }
.result-banner-partial { background: #fbe6e6; color: #8a2a2a; }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: #fff;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -2px;
  animation: pm-spin 0.7s linear infinite;
}
@keyframes pm-spin {
  to { transform: rotate(360deg); }
}
