.bfh-sim-root { box-sizing: border-box; overflow-x: hidden; }
.bfh-sim-root *, .bfh-sim-root *:before, .bfh-sim-root *:after { box-sizing: inherit; }
.bfh-sim-shell { font-size: 14px; line-height: 1.5; min-width: 0; }
.bfh-toolbar, .bfh-tabs, .bfh-member-head, .bfh-party-header { display: flex; gap: 8px; align-items: center; }
.bfh-toolbar, .bfh-tabs, .bfh-userbox, .bfh-message, .bfh-layout { margin-bottom: 16px; }
.bfh-toolbar { flex-wrap: wrap; }
.bfh-toolbar button, .bfh-tabs button, .bfh-member-head button, .bfh-link-button, .bfh-more-button, .bfh-swap-button, .bfh-clear-member {
  padding: 8px 12px; border: 1px solid #cfd4dc; background: #fff; border-radius: 8px; cursor: pointer;
}
.bfh-toolbar button.bfh-primary { font-weight: 700; }
.bfh-tabs button.active { border-color: #111; font-weight: 700; }
.bfh-fixed-layout { display: grid; grid-template-columns: minmax(150px, 0.42fr) minmax(0, 1.58fr); gap: 10px; align-items: start; max-width: 100%; }
.bfh-layout.manual { display: grid; grid-template-columns: 1fr; }
.bfh-sidebar, .bfh-party, .bfh-userbox, .bfh-message, .bfh-member-card {
  border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; padding: 12px;
}
.bfh-message.success { border-color: #95d5b2; }
.bfh-message.error { border-color: #ef9a9a; }
.bfh-sticky-box { position: static; display: grid; gap: 10px; min-width: 0; }
.bfh-picker-banner { padding: 8px 10px; border-radius: 10px; background: #111; color: #fff; font-size: 12px; }
.bfh-asset-tools { display: grid; gap: 8px; margin-bottom: 8px; }
.bfh-asset-tools input, .bfh-field input, .bfh-field select {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd4dc; border-radius: 8px; background: #fff;
}
.bfh-asset-meta { color: #666; font-size: 12px; }
.bfh-asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; max-height: 520px; overflow: auto; padding-right: 4px; }
.bfh-asset-card {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px; min-height: 70px;
  border: 1px solid #dbe2ea; border-radius: 10px; background: #fff; cursor: pointer;
}
.bfh-card-info {
  position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid #cfd4dc; background: #fff; font-size: 10px; line-height: 1; padding: 0; display: inline-flex; align-items: center; justify-content: center; z-index: 5; pointer-events: auto;
}
.bfh-asset-card img, .bfh-modal-image, .bfh-order-token img { width: 50px; height: 50px; object-fit: contain; }
.bfh-broken-image { opacity: 0.35; }
.bfh-asset-card small { color: #666; font-size: 10px; }
.bfh-empty { color: #666; padding: 8px 0; }
.bfh-more-wrap { margin-top: 8px; text-align: center; }
.bfh-main { display: grid; gap: 12px; min-width: 0; justify-items: start; align-content: start; }
.bfh-main.full { grid-template-columns: 1fr; }
.bfh-field { display: grid; gap: 6px; margin-bottom: 10px; }
.bfh-field.compact { margin-bottom: 0; min-width: 160px; }
.bfh-filter-row { display: flex; flex-wrap: wrap; gap: 6px; }
.bfh-chip { padding: 6px 10px; border: 1px solid #cfd4dc; background: #fff; border-radius: 999px; cursor: pointer; font-size: 12px; }
.bfh-chip.active { border-color: #111; font-weight: 700; }
.bfh-toggle-row { font-size: 12px; color: #444; }
.bfh-toggle-row label { display: inline-flex; align-items: center; gap: 6px; }
.bfh-asset-card.is-assigned { border-color: #111; box-shadow: inset 0 0 0 1px #111; }
.bfh-asset-card.is-pick-target { background: #f8fafc; }
.bfh-assigned-badge { display: inline-block; padding: 2px 6px; border-radius: 999px; background: #f1f5f9; color: #111; font-size: 10px; }


.bfh-sidebar, .bfh-main { min-width: 0; }
.bfh-fixed-layout > .bfh-sidebar, .bfh-fixed-layout > .bfh-main {
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-gutter: stable;
}
.bfh-fixed-layout > .bfh-main { padding-right: 6px; }
.compact-party { width: fit-content; max-width: 100%; padding: 8px 10px; }
.compact-party .bfh-party-header { margin-bottom: 6px; }
.compact-party h3 { margin: 0; }
.compact-party .bfh-field.compact { min-width: 132px; }
.compact-party .bfh-party-header { justify-content: space-between; align-items: end; gap: 8px; }
.bfh-compact-grid { display: grid; grid-template-columns: 1fr; gap: 6px; justify-items: start; }
.bfh-compact-card { border: 1px solid #e5e7eb; border-radius: 12px; padding: 6px 8px; background: #fbfdff; min-width: 0; width: fit-content; max-width: 100%; }
.bfh-compact-card.is-selected { border-color: #111827; box-shadow: inset 0 0 0 2px #111827; background: #eef6ff; }
.bfh-compact-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.bfh-compact-head strong { font-size: 13px; }
.bfh-clear-member { padding: 3px 7px; font-size: 11px; }
 .bfh-picker-stack { display: grid; gap: 8px; margin-top: 8px; }
.bfh-picker-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bfh-picker-item { display: grid; justify-items: center; gap: 4px; }
.bfh-picker-item label { font-size: 10px; color: #475569; }
.bfh-order-block { display: grid; gap: 6px; }
.bfh-order-row { display: grid; grid-template-columns: 52px 28px 52px 28px 52px; gap: 3px; align-items: center; justify-content: start; }
.bfh-order-token { position: relative; width: 52px; height: 52px; min-height: 52px; border: 1px solid #cfd4dc; border-radius: 12px; background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; }
.bfh-order-token.is-active { border-color: #0f172a; box-shadow: 0 0 0 2px #0f172a, 0 0 0 5px rgba(59,130,246,0.18); background: #eff6ff; }
.bfh-order-token img { width: 50px; height: 50px; object-fit: contain; }
.bfh-order-badge { position: absolute; top: 3px; left: 4px; font-size: 9px; line-height: 1; padding: 2px 4px; border-radius: 999px; background: rgba(15,23,42,0.9); color: #fff; }
.bfh-search-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.bfh-search-button { padding: 8px 10px; border: 1px solid #cfd4dc; background: #fff; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.bfh-card-badge { position: absolute; top: 4px; left: 4px; font-size: 9px; line-height: 1; padding: 2px 4px; border-radius: 999px; background: rgba(15,23,42,0.9); color: #fff; }
.bfh-slot-wrap { position: relative; }
.bfh-picker-slot {
  width: 52px; height: 52px; border: 1px solid #cfd4dc; border-radius: 12px; background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer;
}
.bfh-picker-slot.is-active { border-color: #111; box-shadow: inset 0 0 0 2px #111; }
.bfh-slot-plus { font-size: 24px; color: #94a3b8; line-height: 1; }
.bfh-slot-clear {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid #cfd4dc; background: #fff; cursor: pointer; font-size: 11px; line-height: 1;
}
.bfh-swap-button { padding: 0; min-width: 0; width: 28px; height: 24px; font-size: 10px; border: 1px solid #cfd4dc; background: #fff; border-radius: 8px; cursor: pointer; }

.bfh-member-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.bfh-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 99999;
}
.bfh-modal {
  position: relative; max-width: 420px; width: 100%; background: #fff; border-radius: 14px; padding: 20px; display: grid; gap: 8px;
}
.bfh-modal-close {
  position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid #cfd4dc; background: #fff; cursor: pointer;
}
.bfh-param-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin: 6px 0; }
.bfh-param-grid div { padding: 4px 8px; border: 1px solid #edf2f7; border-radius: 8px; background: #f8fafc; font-size: 12px; }

.bfh-stealth-tab { background: transparent !important; color: transparent !important; border-color: transparent !important; box-shadow: none !important; }
.bfh-stealth-tab.active, .bfh-stealth-tab:focus, .bfh-stealth-tab:hover { background: transparent !important; color: transparent !important; border-color: transparent !important; box-shadow: none !important; }

@media (max-width: 1180px) { .bfh-fixed-layout { grid-template-columns: minmax(130px, 0.38fr) minmax(0, 1.62fr); } .bfh-party-header h3 { font-size: 18px; } .bfh-fixed-layout > .bfh-sidebar, .bfh-fixed-layout > .bfh-main { max-height: calc(100vh - 180px); } }
