/* 机构上下文 chip（公共页 / 游戏页 / SPA 共用）。只做样式，不引入图片或网络字体。 */
.xj-tenant-context {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin: 0;
  font-family: var(--font-sans, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif);
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}
.xj-tenant-context[hidden] { display: none; }
.xj-tenant-context--floating {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 60;
  max-width: min(360px, calc(100vw - 24px));
}
.xj-tenant-chip {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--ink, #22211e);
  border-radius: var(--radius-sm);
  background: var(--panel, #ffffff);
  color: var(--ink, #22211e);
  box-shadow: var(--shadow-sm, 2px 2px 0 var(--line, #d5d1c8));
}
.xj-tenant-chip__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  max-width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.xj-tenant-chip__label {
  color: var(--muted, #655f56);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .06em;
  white-space: nowrap;
}
.xj-tenant-chip__name {
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.xj-tenant-chip__role {
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid var(--line, #d5d1c8);
  border-radius: var(--radius-xs);
  color: var(--muted, #655f56);
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
}
.xj-tenant-chip__dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good, #17613b);
}
.xj-tenant-context[data-state="warning"] .xj-tenant-chip__dot { background: var(--yellow, #edc84c); }
.xj-tenant-context[data-state="invalid"] .xj-tenant-chip__dot { background: var(--bad, #a12c29); }
.xj-tenant-chip__caret {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}
.xj-tenant-chip__toggle[aria-expanded="true"] .xj-tenant-chip__caret { transform: rotate(180deg); }
.xj-tenant-chip__exit {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-left: 1px solid var(--line, #d5d1c8);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: transparent;
  color: var(--muted, #655f56);
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.xj-tenant-chip__exit:hover { background: var(--bad-bg, #f7ebe8); color: var(--bad, #a12c29); }
.xj-tenant-chip__exit:disabled { opacity: .55; cursor: wait; }
.xj-tenant-chip__toggle:focus-visible,
.xj-tenant-chip__exit:focus-visible,
.xj-tenant-chip__link:focus-visible,
.xj-tenant-chip__message-link:focus-visible {
  outline: 3px solid var(--yellow, #edc84c);
  outline-offset: 2px;
}
.xj-tenant-chip__panel {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 2;
  width: max-content;
  min-width: 260px;
  max-width: min(360px, calc(100vw - 24px));
  padding: 12px 14px;
  border: 1px solid var(--ink, #22211e);
  border-radius: var(--radius-sm);
  background: var(--panel, #ffffff);
  color: var(--ink, #22211e);
  box-shadow: var(--shadow-lift, 4px 4px 0 var(--ink, #22211e));
}
.xj-tenant-chip__panel[hidden] { display: none; }
.xj-tenant-context--floating .xj-tenant-chip__panel {
  top: auto;
  bottom: calc(100% + 6px);
}
.xj-tenant-chip__meta,
.xj-tenant-chip__practice {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
}
.xj-tenant-chip__meta { color: var(--muted, #655f56); }
.xj-tenant-chip__practice { margin-top: 8px; overflow-wrap: anywhere; }
.xj-tenant-chip__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.xj-tenant-chip__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--control-line, #797164);
  border-radius: var(--radius-sm);
  color: var(--ink, #22211e);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.xj-tenant-chip__link:hover { box-shadow: 2px 2px 0 var(--yellow, #edc84c); }
.xj-tenant-chip__message {
  margin: 6px 0 0;
  padding: 8px 10px;
  border-left: 4px solid var(--bad, #a12c29);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  background: var(--bad-bg, #f7ebe8);
  color: var(--bad, #a12c29);
  font-size: 12px;
  line-height: 1.7;
}
.xj-tenant-chip__message[hidden] { display: none; }
.xj-tenant-chip__message-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
  font-weight: 700;
  text-underline-offset: 3px;
}
.xj-tenant-toast {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 61;
  max-width: min(360px, calc(100vw - 24px));
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--ink, #22211e);
  border-radius: var(--radius-sm);
  background: var(--ink, #22211e);
  color: var(--bg-0, #fdfcf3);
  font-family: var(--font-sans, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif);
  font-size: 12px;
  line-height: 1.7;
  box-shadow: 3px 3px 0 var(--yellow, #edc84c);
}
@media (max-width: 600px) {
  .xj-tenant-context--floating {
    left: 12px;
    right: 12px;
    max-width: none;
  }
  .xj-tenant-chip__name { max-width: 40vw; }
  .xj-tenant-chip__panel {
    width: 100%;
    min-width: 0;
  }
  .xj-tenant-chip__link { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 420px) {
  .xj-tenant-chip__label { display: none; }
  .xj-tenant-chip__name { max-width: 32vw; }
  .xj-tenant-chip__toggle { gap: 6px; padding-left: 8px; padding-right: 6px; }
}
@media (prefers-reduced-motion: no-preference) {
  .xj-tenant-chip__caret { transition: transform .15s ease; }
  .xj-tenant-chip__link,
  .xj-tenant-chip__exit { transition: box-shadow .15s ease, background-color .15s ease; }
}
