/* マイ市場（ヘッダー内の列）と、式バー右端の保存操作
   トークンは mktg-auth.css と共通（藍＝選択・A、若竹＝B、煉瓦＝注意） */
.ms {
  margin: 12px 0 0;
  font-family: var(--mktg-font, system-ui, sans-serif);
}
.ms.is-busy { cursor: progress; }
.ms.is-busy .ms-grid { opacity: 0.6; pointer-events: none; }

.ms-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 8px;
}
.ms-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--mktg-sumi, #1a2b3f);
}
.ms-hint {
  font-size: 12px;
  color: var(--mktg-haiao, #5b6b7d);
}
.ms-head-extra { margin-left: auto; }

/* 同じ大きさの縦長カードを格子状に並べる */
.ms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.ms-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 118px;
  margin: 0;
  border: 1px solid var(--mktg-line, #c3cedb);
  border-radius: 10px;
  background: var(--mktg-paper, #fff);
  font: inherit;
  text-align: left;
}
.ms-card:hover { border-color: var(--mktg-ai, #274c77); }
.ms-card.is-on {
  border-color: var(--mktg-ai, #274c77);
  box-shadow: inset 0 0 0 1px var(--mktg-ai, #274c77);
  background: #eef3f9;
}

.ms-card--new {
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-style: dashed;
  background: transparent;
  color: var(--mktg-ai, #274c77);
  cursor: pointer;
}
.ms-card--new[aria-pressed="true"] {
  border-style: solid;
  background: #eef3f9;
}
.ms-new-mark { font-size: 22px; line-height: 1; }
.ms-new-label { font-size: 13px; font-weight: 600; }

.ms-card--empty,
.ms-card--invite {
  justify-content: center;
  gap: 4px;
  padding: 12px 14px;
  border-style: dashed;
  background: transparent;
  font-size: 12.5px;
  color: var(--mktg-haiao, #5b6b7d);
}
.ms-card--invite { cursor: pointer; }
.ms-invite-sub { font-size: 12px; line-height: 1.6; }

.ms-pick {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 11px 30px 26px 13px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ms-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.ms-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--mktg-sumi, #1a2b3f);
}
.ms-def {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.ms-def-row {
  display: grid;
  grid-template-columns: 2.6em 1fr;
  gap: 4px;
  min-width: 0;
  font-size: 11.5px;
  line-height: 1.45;
}
.ms-def-label { color: var(--mktg-haiao, #5b6b7d); }
.ms-def-value {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--mktg-sumi, #1a2b3f);
}
.ms-badge {
  flex: none;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--mktg-ai, #274c77);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}
.ms-badge--b { background: var(--mktg-wakatake, #2e8b74); }

.ms-remove,
.ms-more {
  position: absolute;
  right: 4px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--mktg-haiao, #5b6b7d);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.ms-remove { top: 4px; }
.ms-more { bottom: 4px; }
.ms-remove:hover { background: #fbeee8; color: var(--mktg-renga, #b85c38); }
.ms-more:hover { background: #f2f5f9; }

.ms-menu {
  position: absolute;
  top: calc(100% - 4px);
  right: 4px;
  z-index: 30;
  display: grid;
  min-width: 140px;
  padding: 4px;
  border: 1px solid var(--mktg-line, #c3cedb);
  border-radius: 8px;
  background: var(--mktg-paper, #fff);
  box-shadow: 0 12px 24px -16px rgba(26, 43, 63, 0.5);
}
.ms-menu button {
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--mktg-sumi, #1a2b3f);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.ms-menu button:hover { background: #f2f5f9; }

.ms-message {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--mktg-renga, #b85c38);
}

.ms-input {
  min-width: 0;
  width: 280px;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--mktg-line, #c3cedb);
  border-radius: 6px;
  background: #fff;
  color: var(--mktg-sumi, #1a2b3f);
  font: inherit;
  font-size: 13px;
}
.ms-input--card { width: 100%; padding: 3px 8px; font-size: 13px; }

.ms :focus-visible,
.ms-form :focus-visible {
  outline: 2px solid var(--mktg-wakatake, #2e8b74);
  outline-offset: 2px;
}

/* 式バー（濃い背景）の中の保存操作 */
#marketSave {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
#marketSave:empty { display: none; }
.ms-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ms-state {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
}
.ms-state--warn { color: #f3b9a2; }
.fbtn.ms-fbtn--primary {
  background: #6fc7b0;
  border-color: #6fc7b0;
  color: var(--mktg-sumi, #1a2b3f);
  font-weight: 700;
}
.fbtn.ms-fbtn--primary:hover { background: #8ad6c2; }

@media print {
  .ms, #marketSave { display: none !important; }
}
