/* ==========================================================================
   《燕云十六声》百业关系星图 · 水墨金石武侠美学样式表
   ========================================================================== */

:root {
  --bg-deep: #0b0e14;
  --bg-surface: #121721;
  --bg-elevated: #192130;
  --bg-card: rgba(21, 27, 39, 0.92);
  --bg-glass: rgba(14, 18, 27, 0.84);

  --gold: #d6b26e;
  --gold-bright: #f2d591;
  --gold-dim: rgba(214, 178, 110, 0.24);
  --gold-soft: rgba(214, 178, 110, 0.12);

  --crimson: #ef6b82;
  --jade: #48c7b8;
  --amber: #f0a848;
  --violet: #a38bf8;
  --danger: #e05a5a;
  --success: #5ac48a;

  --text-main: #ede6d8;
  --text-sub: #a8b0c0;
  --text-muted: #70798c;

  --border: rgba(214, 178, 110, 0.18);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
  --radius: 12px;
  --radius-sm: 8px;

  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-sub);
}

code {
  font-family: Consolas, Menlo, monospace;
  background: rgba(214, 178, 110, 0.14);
  color: var(--gold-bright);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* ================= 通用按钮与表单 ================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn:hover {
  background: rgba(214, 178, 110, 0.14);
  border-color: var(--gold);
}

.btn-gold {
  background: linear-gradient(135deg, #c9a156 0%, #e4c27c 100%);
  color: #16120b;
  border-color: #f0d495;
  font-weight: 600;
}

.btn-gold:hover {
  background: linear-gradient(135deg, #d7af62 0%, #f1d494 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(214, 178, 110, 0.35);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-sub);
}

.btn-ghost:hover {
  color: var(--text-main);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  background: rgba(224, 90, 90, 0.14);
  border-color: rgba(224, 90, 90, 0.45);
  color: #ff9c9c;
}

.btn-danger:hover {
  background: rgba(224, 90, 90, 0.28);
  border-color: #ff8080;
}

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

.btn-block {
  width: 100%;
}

.btn-link {
  background: none;
  border: none;
  color: var(--gold-bright);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
}

.btn-link:hover {
  text-decoration: underline;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.16s ease;
}

.icon-btn:hover {
  color: var(--gold-bright);
  border-color: var(--gold);
  background: var(--gold-soft);
}

.input, .select, .textarea {
  width: 100%;
  background: #0d121b;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(214, 178, 110, 0.15);
}

.textarea {
  resize: vertical;
  min-height: 76px;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 5px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ================= 暗号门禁层 ================= */

.gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background:
    radial-gradient(circle at 50% 35%, rgba(214, 178, 110, 0.12) 0%, transparent 55%),
    rgba(7, 10, 15, 0.94);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gate-card {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, rgba(24, 31, 45, 0.96) 0%, rgba(15, 20, 30, 0.98) 100%);
  border: 1px solid var(--gold-dim);
  border-radius: 18px;
  padding: 36px 30px 28px;
  text-align: center;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(242, 213, 145, 0.16);
}

.gate-seal {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 14px;
  border: 2px solid var(--gold);
  background: linear-gradient(145deg, rgba(160, 48, 48, 0.85), rgba(105, 26, 26, 0.92));
  color: #f9e9c7;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.18;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(150, 40, 40, 0.4);
  letter-spacing: 2px;
}

.gate-title {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 26px;
  color: var(--gold-bright);
  letter-spacing: 3px;
}

.gate-subtitle {
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--text-sub);
}

.gate-form {
  text-align: left;
}

.gate-label {
  display: block;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.gate-input-row {
  display: flex;
  gap: 8px;
}

.gate-error {
  min-height: 20px;
  margin-top: 8px;
  color: #ff8e8e;
  font-size: 12px;
}

.gate-demo-tip {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-sub);
}

/* ================= 顶部导航 ================= */

.topbar {
  height: 58px;
  background: rgba(13, 17, 25, 0.95);
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: relative;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.brand-crest {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--gold);
  background: linear-gradient(145deg, #8e3333, #5c1e1e);
  color: var(--gold-bright);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 1px;
  white-space: nowrap;
}

.brand-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.topbar-center {
  flex: 1;
  max-width: 400px;
}

.search-wrap {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-main);
  padding: 7px 32px 7px 32px;
  font-size: 13px;
  outline: none;
  transition: all 0.16s ease;
}

.search-input:focus {
  background: #0d121c;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(214, 178, 110, 0.14);
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #151c29;
  border: 1px solid var(--gold-dim);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-height: 360px;
  overflow-y: auto;
  z-index: 120;
  padding: 6px;
}

.search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.14s ease;
}

.search-item:hover {
  background: rgba(214, 178, 110, 0.12);
}

.search-item-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.search-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.search-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.search-item-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sub);
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  color: var(--gold-bright);
  background: var(--gold-soft);
  border-color: var(--gold-dim);
  font-weight: 600;
}

.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.nav-badge {
  background: rgba(240, 168, 72, 0.22);
  color: #ffc875;
  border: 1px solid rgba(240, 168, 72, 0.5);
  border-radius: 999px;
  padding: 0 6px;
  font-size: 11px;
  line-height: 17px;
}

/* ================= 主工作区与视图 ================= */

.workspace {
  height: calc(100vh - 58px);
  position: relative;
  overflow: hidden;
}

.view {
  display: none;
  width: 100%;
  height: 100%;
}

.view.active {
  display: flex;
  flex-direction: column;
}

/* ================= 视图 1：星图 ================= */

.view-graph {
  position: relative;
  background:
    radial-gradient(circle at 50% 48%, #181b21 0%, #111318 58%, #0c0e12 100%);
}

.graph-toolbar {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  pointer-events: auto;
}

.toolbar-right {
  pointer-events: auto;
  flex-shrink: 0;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
}

.filter-pill:hover {
  border-color: var(--border);
  color: var(--text-main);
}

.filter-pill.active {
  color: var(--text-main);
  border-color: var(--pill-color, var(--gold));
  background: rgba(20, 27, 40, 0.92);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
}

.filter-pill:not(.active) {
  opacity: 0.48;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pill-count {
  font-size: 11px;
  color: var(--text-muted);
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-sub);
  cursor: pointer;
  user-select: none;
}

.toggle-chip input {
  accent-color: var(--gold);
}

.focus-banner {
  position: absolute;
  top: 56px;
  left: 14px;
  z-index: 25;
  background: rgba(18, 24, 36, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--gold-dim);
  border-radius: 14px;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-width: calc(100% - 384px);
}

.focus-banner-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  white-space: nowrap;
}

.focus-badge {
  background: var(--gold-soft);
  color: var(--gold-bright);
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  flex-shrink: 0;
}

.focus-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.segmented {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  padding: 2px;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-sub);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.seg-btn.active {
  background: var(--gold);
  color: #161108;
  font-weight: 600;
}

.graph-stage {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
}

#graphCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#graphCanvas.dragging {
  cursor: grabbing;
}

#graphCanvas.pointer {
  cursor: pointer;
}

.graph-tooltip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: rgba(15, 20, 30, 0.96);
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
  padding: 9px 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  max-width: 260px;
  font-size: 12px;
}

.tooltip-title {
  font-weight: 700;
  color: var(--gold-bright);
  font-size: 13px;
  margin-bottom: 3px;
}

.tooltip-line {
  color: var(--text-sub);
  margin-top: 2px;
}

.graph-hint {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 15;
  background: rgba(12, 16, 24, 0.72);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
  max-width: calc(100% - 490px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.graph-controls {
  position: absolute;
  right: 16px;
  bottom: 14px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.ctrl-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sub);
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.ctrl-btn.active {
  background: var(--gold-soft);
  color: var(--gold-bright);
  border-color: var(--gold-dim);
}

.ctrl-divider {
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
  margin: 0 2px;
}

/* ================= 详情抽屉（PC 右侧 / 手机底部） ================= */

.detail-drawer {
  position: absolute;
  top: 62px;
  right: 14px;
  bottom: 66px;
  width: 348px;
  z-index: 30;
  background: rgba(15, 20, 30, 0.94);
  backdrop-filter: blur(14px);
  border: 1px solid var(--gold-dim);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: drawerIn 0.2s ease;
}

@keyframes drawerIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

.drawer-header {
  padding: 14px 14px 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(180deg, rgba(214, 178, 110, 0.08) 0%, transparent 100%);
}

.drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.drawer-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.drawer-name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-bright);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.drawer-sub {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 2px;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 18px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-sub);
}

.tag-gold {
  border-color: var(--gold-dim);
  background: var(--gold-soft);
  color: var(--gold-bright);
}

.tag-left {
  border-color: rgba(160, 170, 185, 0.35);
  background: rgba(120, 130, 145, 0.18);
  color: #b4bccb;
}

.drawer-bio {
  font-size: 12.5px;
  color: var(--text-sub);
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid var(--gold-dim);
  padding: 8px 10px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 14px;
}

.drawer-section {
  margin-bottom: 16px;
}

.drawer-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sworn-box {
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(240, 168, 72, 0.35);
  background: rgba(240, 168, 72, 0.08);
}

.sworn-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.sworn-box-name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: #ffd38c;
}

.sworn-box-motto {
  font-size: 11.5px;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.member-chip:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold-bright);
}

.member-chip.current {
  border-color: var(--gold);
  background: rgba(214, 178, 110, 0.22);
  color: var(--gold-bright);
  cursor: default;
}

.rel-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.rel-card-item:hover {
  border-color: var(--gold-dim);
  background: rgba(214, 178, 110, 0.08);
}

.rel-card-left {
  min-width: 0;
}

.rel-card-top {
  display: flex;
  align-items: center;
  gap: 7px;
}

.rel-role-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  color: #10141c;
}

.rel-card-note {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.multi-bond-box {
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(242, 213, 145, 0.45);
  background: linear-gradient(135deg, rgba(240, 168, 72, 0.1) 0%, rgba(239, 107, 130, 0.08) 52%, rgba(72, 199, 184, 0.09) 100%);
  margin-bottom: 14px;
}

.multi-bond-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(11, 14, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.multi-bond-row:hover {
  border-color: var(--gold);
}

.multi-bond-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff3cf;
  background: linear-gradient(135deg, rgba(240, 168, 72, 0.32), rgba(239, 107, 130, 0.3), rgba(72, 199, 184, 0.3));
  border: 1px solid rgba(242, 213, 145, 0.55);
  white-space: nowrap;
}

.drawer-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* ================= 视图 2：结义名录 ================= */

.view-groups {
  overflow-y: auto;
  background: radial-gradient(circle at 20% 0%, rgba(214, 178, 110, 0.07) 0%, transparent 45%), var(--bg-deep);
}

.page-container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 22px 48px;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.section-header h2 {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--gold-bright);
  letter-spacing: 1px;
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.group-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.group-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
}

.group-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.group-card-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--gold-bright);
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.group-card-motto {
  font-size: 12.5px;
  color: var(--text-sub);
  margin-top: 3px;
}

.group-card-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ================= 视图 3：管理员录入台 ================= */

.view-admin {
  background: var(--bg-deep);
}

.admin-layout {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.admin-sidebar {
  width: 242px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.admin-sidebar-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--gold-bright);
  margin-bottom: 4px;
}

.admin-sidebar-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.admin-menu {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.admin-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.14s ease;
  text-align: left;
}

.admin-menu-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.admin-menu-item.active {
  background: var(--gold-soft);
  border-color: var(--gold-dim);
  color: var(--gold-bright);
  font-weight: 600;
}

.menu-count {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-sub);
}

.menu-count.warn {
  background: rgba(240, 168, 72, 0.22);
  color: #ffd085;
}

.admin-sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.admin-main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 48px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--gold-bright);
}

.rule-banner {
  background: rgba(214, 178, 110, 0.08);
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: #e6d7b9;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold-bright);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.data-table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 9px 10px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table td .tag,
.data-table td .rel-role-badge {
  white-space: nowrap;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.member-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 7px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  background: #0d121b;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.picker-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  font-size: 12.5px;
  transition: all 0.14s ease;
}

.picker-item:hover {
  border-color: var(--gold-dim);
}

.picker-item.selected {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.picker-group-tag {
  font-size: 10px;
  color: #ffc576;
  margin-left: auto;
}

.health-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  margin-bottom: 8px;
  font-size: 12.5px;
}

.health-item.warn {
  background: rgba(240, 168, 72, 0.1);
  border: 1px solid rgba(240, 168, 72, 0.35);
  color: #ffe0ad;
}

.health-item.info {
  background: rgba(110, 184, 232, 0.09);
  border: 1px solid rgba(110, 184, 232, 0.28);
  color: #cfe8fb;
}

.publish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

/* ================= 通用弹窗 & Toast ================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(5, 8, 13, 0.78);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-dialog {
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  background: #141b27;
  border: 1px solid var(--gold-dim);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--gold-bright);
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 950;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(20, 27, 40, 0.96);
  border: 1px solid var(--gold-dim);
  color: var(--text-main);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
  animation: toastIn 0.2s ease;
}

.toast.error {
  border-color: rgba(224, 90, 90, 0.65);
  color: #ffb1b1;
}

.toast.success {
  border-color: rgba(90, 196, 138, 0.65);
  color: #b4f0cd;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= 移动端自适应（手机浏览 & 管理） ================= */

@media (max-width: 820px) {
  .topbar {
    height: auto;
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .brand-meta {
    display: none;
  }

  .topbar-center {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

  .topbar-nav {
    gap: 4px;
  }

  .nav-tab {
    padding: 6px 9px;
    font-size: 12px;
  }

  .workspace {
    height: calc(100vh - 96px);
  }

  .graph-hint {
    display: none;
  }

  .focus-banner {
    top: auto;
    left: 10px;
    right: 10px;
    max-width: none;
    bottom: 64px;
    border-radius: 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 12px;
  }

  .detail-drawer {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: 62vh;
    border-radius: 16px;
  }

  .admin-layout {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
  }

  .admin-sidebar-desc, .admin-sidebar-footer {
    display: none;
  }

  .admin-menu {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .admin-menu-item {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .admin-main {
    padding: 16px 14px 40px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
