/* 기능 설명: 메이플 레코드 캐릭터 투자 (/Char/2/char) - style.css .container 폭 유지 + 5x6 장비창 슬롯 투자 UI/UX */

/* 공통 SVG 아이콘 규격 */
.btn-svg-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: inline-block;
}

.spin-svg {
  animation: charSpin 0.8s linear infinite;
}

@keyframes charSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   1. 상단 캐릭터 등록 · 현황 · 도구 2단 슬림 컨트롤 바
   ========================================================================== */
.char-control-bar {
  background: #151a25;
  border: 1px solid #242e42;
  border-radius: 14px;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  box-sizing: border-box;
}

/* 상단 행: 입력 그룹 + 핵심 현황 */
.char-bar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 18px;
}

.char-add-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 240px;
  max-width: 420px;
}

.char-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.input-leading-svg {
  position: absolute;
  left: 12px;
  width: 15px;
  height: 15px;
  color: #64748b;
  pointer-events: none;
}

.char-add-input-group input {
  width: 100%;
  height: 38px;
  box-sizing: border-box;
  background: #0d1118;
  border: 1px solid #273247;
  color: #f8fafc;
  border-radius: 9px;
  padding: 0 12px 0 35px;
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.char-add-input-group input::placeholder {
  color: #64748b;
  font-weight: 500;
}

.char-add-input-group input:focus {
  border-color: var(--primary, #f0883e);
  box-shadow: 0 0 0 3px rgba(240, 136, 62, 0.14);
}

.btn-char-register {
  height: 38px;
  background: linear-gradient(180deg, #ff7b54 0%, #f0643b 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 160, 122, 0.35);
  padding: 0 16px;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-char-register:hover:not(:disabled) {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.btn-char-register:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 우측 핵심 현황 인라인 캡슐 */
.char-kpi-inline {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  height: 38px;
  padding: 0 16px;
  background: #0e131d;
  border: 1px solid #20293c;
  border-radius: 9px;
  box-sizing: border-box;
}

.kpi-inline-item {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
}

.kpi-inline-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #8b949e;
}

.kpi-inline-divider {
  width: 1px;
  height: 16px;
  background: #232e44;
  flex-shrink: 0;
}

.highlight-count {
  color: #38bdf8;
  font-size: 0.94rem;
  font-weight: 900;
}

.highlight-sum {
  color: #ff9854;
  font-size: 0.96rem;
  font-weight: 900;
}

/* 하단 행: 1클릭 정렬 탭 + 유틸 버튼 바 */
.char-bar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 9px 18px;
  background: rgba(10, 14, 22, 0.55);
  border-top: 1px solid #1e273a;
}

.char-sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.char-sort-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
}

.char-sort-pills {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #0d1118;
  border: 1px solid #20293c;
  padding: 3px;
  border-radius: 8px;
}

.char-sort-pill {
  background: transparent;
  border: 1px solid transparent;
  color: #8b949e;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.char-sort-pill:hover {
  color: #e2e8f0;
}

.char-sort-pill.active {
  background: #202a3e;
  border-color: #33425f;
  color: #ffffff;
  font-weight: 800;
}

/* 우측 유틸 버튼 그룹 (높이 32px 통일 · 톤온톤 소프트 틴트) */
.char-export-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.toolbar-btn-divider {
  width: 1px;
  height: 16px;
  background: #232e44;
  margin: 0 2px;
}

.btn-util-ghost,
.btn-import-invest,
.btn-export-csv {
  height: 32px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.btn-util-ghost {
  background: #171d2b;
  border: 1px solid #283349;
  color: #cbd5e1;
}

.btn-util-ghost:hover:not(:disabled) {
  background: #212a3d;
  border-color: #3d4d6b;
  color: #ffffff;
}

.btn-util-ghost:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-import-invest {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.34);
  color: #6ee7b7;
}

.btn-import-invest:hover {
  background: rgba(52, 211, 153, 0.22);
  border-color: rgba(110, 231, 183, 0.6);
  color: #ecfdf5;
}

.btn-export-csv {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.34);
  color: #7dd3fc;
}

.btn-export-csv:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(125, 211, 252, 0.6);
  color: #e0f2fe;
}

/* ==========================================================================
   2. 캐릭터 4열 카드 그리드 & 요약 바
   ========================================================================== */
.invest-char-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.char-card-unit {
  background: #161b26;
  border: 1px solid #263044;
  border-radius: 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.char-card-unit:not(.expanded):hover {
  border-color: #3d4d6b;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.char-card-unit.expanded {
  grid-column: 1 / -1;
  border-color: var(--primary, #f0883e);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  background: #141923;
}

.char-card-summary {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  gap: 13px;
  background: #161b26;
  border-bottom: 1px solid transparent;
}

.char-card-unit.expanded .char-card-summary {
  border-bottom: 1px solid #263044;
  background: #19202e;
  padding: 14px 20px;
}

.card-avatar-box {
  width: 74px;
  height: 74px;
  background: radial-gradient(circle at 50% 60%, #202a3f 0%, #0d1118 100%);
  border: 1px solid #263147;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-avatar-img {
  width: 66px;
  height: 66px;
  object-fit: contain;
  transform: scale(2.4);
  transform-origin: center 58%;
  image-rendering: pixelated;
  pointer-events: none;
}

.card-avatar-img[src$="logo.png"] {
  transform: scale(0.9);
  image-rendering: auto;
}

.card-meta-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.card-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.card-top-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.card-lvl-tag {
  color: #facc15;
  font-size: 0.78rem;
  font-weight: 800;
}

.card-world-tag {
  color: #38bdf8;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.11);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  white-space: nowrap;
}

.card-class-tag {
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-summary-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-card-delete {
  background: transparent;
  border: 1px solid transparent;
  color: #64748b;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.14s ease;
}

.btn-card-delete svg {
  width: 14px;
  height: 14px;
}

.btn-card-delete:hover {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.14);
  border-color: rgba(244, 63, 94, 0.32);
}

.card-row-mid {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-name-txt {
  font-size: 1.05rem;
  font-weight: 900;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-row-bot {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.77rem;
  color: #94a3b8;
  white-space: nowrap;
}

.bot-stat-val {
  color: #fb923c;
  font-weight: 800;
}

.bot-union-val {
  color: #2dd4bf;
  font-weight: 800;
}

.card-invest-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.card-invest-tag-row {
  font-size: 0.78rem;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-invest-val {
  color: var(--primary, #f0883e);
  font-weight: 800;
}

.card-expand-hint {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  flex-shrink: 0;
}

.card-expand-hint svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.char-card-unit.expanded .card-expand-hint {
  color: var(--primary, #f0883e);
}

.char-card-unit.expanded .card-expand-hint svg {
  transform: rotate(180deg);
}

/* ==========================================================================
   3. 펼쳐지는 상세 투자 드로어 (5x6 장비창 + 우측 현황 + 하단 교체 이력 요약)
   ========================================================================== */
.char-card-drawer {
  display: none;
  padding: 20px 22px 22px 22px;
  background: #11151f;
}

.char-card-unit.expanded .char-card-drawer {
  display: block;
}

.drawer-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid #20283a;
}

.drawer-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.drawer-title-svg {
  width: 18px;
  height: 18px;
  color: #ff9854;
  flex-shrink: 0;
}

.drawer-top-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.drawer-sum-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: #94a3b8;
}

.sum-pill-chip {
  background: #161c29;
  border: 1px solid #253047;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.sum-pill-chip strong {
  color: #e2e8f0;
  margin-left: 3px;
}

.sum-pill-chip.is-total {
  background: rgba(240, 136, 62, 0.12);
  border-color: rgba(240, 136, 62, 0.35);
  color: #ff9854;
}

.sum-pill-chip.is-total strong {
  color: #ff9854;
}

.btn-add-etc-invest {
  background: #1a2233;
  border: 1px solid #2f3d58;
  color: #e2e8f0;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-add-etc-invest:hover {
  background: #232d44;
  border-color: #38bdf8;
  color: #ffffff;
}

/* 메인 2단 레이아웃: 좌측 5x6 장비 보드 / 우측 장착 현황 리스트 */
.drawer-workspace {
  display: grid;
  grid-template-columns: 468px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

/* 좌측: 성장 기록 스타일 5x6 장비창 보드 */
.equip-board-panel {
  background: #141925;
  border: 1px solid #232c40;
  border-radius: 14px;
  padding: 15px;
  box-sizing: border-box;
}

.equip-board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.equip-board-title {
  font-size: 0.84rem;
  font-weight: 800;
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.equip-board-title svg {
  width: 15px;
  height: 15px;
  color: #38bdf8;
}

.equip-board-hint {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
}

.equip-slot-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.equip-slot-spacer {
  visibility: hidden;
  pointer-events: none;
}

/* 개별 장비 슬롯 타일 (두번째 사진 '성장 기록' 스타일 기반) */
.equip-slot-tile {
  position: relative;
  height: 88px;
  background: #101520;
  border: 1px solid #242f44;
  border-radius: 11px;
  padding: 6px 4px 5px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.16s ease;
  box-sizing: border-box;
  color: inherit;
  font-family: inherit;
  overflow: hidden;
}

.equip-slot-tile:hover {
  border-color: #38bdf8;
  background: #161e2f;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

/* 아이템이 등록된 슬롯 강조 */
.equip-slot-tile.is-filled {
  background: linear-gradient(180deg, #16202d 0%, #101722 100%);
  border-color: rgba(52, 211, 153, 0.48);
}

.equip-slot-tile.is-filled:hover {
  border-color: #34d399;
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.35), 0 6px 16px rgba(0, 0, 0, 0.4);
}

.slot-tile-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  min-height: 15px;
  padding: 0 2px;
  box-sizing: border-box;
}

.slot-price-pill {
  font-size: 0.63rem;
  font-weight: 900;
  color: #fbbf24;
  line-height: 1;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-hist-dot {
  font-size: 0.58rem;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 4px;
  padding: 1px 3px;
  line-height: 1;
  flex-shrink: 0;
}

/* 빈 슬롯 중앙 + 아이콘 */
.slot-empty-plus {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgba(148, 163, 184, 0.06);
  border: 1px dashed #2b3850;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.slot-empty-plus svg {
  width: 13px;
  height: 13px;
}

.equip-slot-tile:hover .slot-empty-plus {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.1);
}

/* 등록된 아이템 아이콘 */
.slot-filled-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
}

.slot-tile-label {
  font-size: 0.69rem;
  font-weight: 700;
  color: #94a3b8;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.equip-slot-tile.is-filled .slot-tile-label {
  color: #e2e8f0;
  font-weight: 800;
}

/* 우측: 현재 장착 아이템 투자 상세 목록 패널 */
.equipped-summary-panel {
  background: #141925;
  border: 1px solid #232c40;
  border-radius: 14px;
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  box-sizing: border-box;
}

.panel-sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-sub-title {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 800;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.panel-sub-title svg {
  width: 15px;
  height: 15px;
  color: #34d399;
}

.panel-sub-count {
  font-size: 0.76rem;
  font-weight: 800;
  color: #ff9854;
}

/* 카테고리 비중 미니 바 */
.cat-breakdown-wrap {
  background: #0f141e;
  border: 1px solid #1f283b;
  border-radius: 9px;
  padding: 10px 12px;
}

.cat-breakdown-bar {
  display: flex;
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: #090c12;
  gap: 2px;
  margin-bottom: 8px;
}

.cat-bar-seg {
  height: 100%;
  min-width: 4px;
  border-radius: 2px;
}

.cat-breakdown-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 0.72rem;
  color: #cbd5e1;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-pct {
  color: #64748b;
  font-weight: 700;
}

/* 장착 리스트 스크롤 영역 */
.equipped-list-scroll {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 492px;
  overflow-y: auto;
  padding-right: 2px;
}

.equipped-row-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #0f141e;
  border: 1px solid #202a3d;
  border-radius: 9px;
  padding: 8px 11px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.equipped-row-card:hover {
  border-color: #364766;
  background: #151c2a;
}

.eq-row-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.eq-slot-tag {
  font-size: 0.68rem;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.11);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 2px 6px;
  border-radius: 5px;
  min-width: 44px;
  text-align: center;
  flex-shrink: 0;
}

.eq-row-thumb {
  width: 26px;
  height: 26px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.eq-row-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.eq-row-name {
  font-size: 0.83rem;
  font-weight: 800;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eq-row-memo {
  font-size: 0.71rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eq-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.eq-row-cost {
  font-size: 0.82rem;
  font-weight: 800;
  color: #ff9854;
  white-space: nowrap;
}

.equipped-empty-guide {
  background: #0f141e;
  border: 1px dashed #253147;
  border-radius: 10px;
  padding: 36px 18px;
  text-align: center;
  color: #64748b;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.equipped-empty-guide svg {
  width: 30px;
  height: 30px;
  color: #3b4b68;
}

.equipped-empty-guide strong {
  color: #cbd5e1;
  font-size: 0.88rem;
}

.equipped-empty-guide span {
  font-size: 0.78rem;
  line-height: 1.45;
}

/* ==========================================================================
   4. 하단 요약 섹션: 이전 변경(교체) 내역 & 기타·강화 투자
   ========================================================================== */
.drawer-history-section {
  margin-top: 18px;
  background: #141925;
  border: 1px solid #232c40;
  border-radius: 14px;
  padding: 15px 18px;
}

.history-sec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #1f283b;
}

.history-sec-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.history-sec-title svg {
  width: 16px;
  height: 16px;
  color: #fbbf24;
}

.history-sec-tabs {
  display: inline-flex;
  gap: 5px;
}

.btn-hist-tab {
  background: #0f141e;
  border: 1px solid #242f44;
  color: #94a3b8;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.btn-hist-tab.active {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.42);
  color: #fbbf24;
}

.history-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 9px;
}

.history-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #0f141e;
  border: 1px solid #202a3d;
  border-left: 3px solid #f59e0b;
  border-radius: 9px;
  padding: 9px 11px;
  min-width: 0;
}

.history-item-card.is-etc {
  border-left-color: #a855f7;
}

.hist-card-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.hist-thumb {
  width: 26px;
  height: 26px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
  opacity: 0.88;
}

.hist-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.hist-top-line {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.hist-slot-badge {
  font-size: 0.66rem;
  font-weight: 800;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.28);
  padding: 1px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}

.hist-slot-badge.is-etc {
  color: #c084fc;
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.3);
}

.hist-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-sub-line {
  font-size: 0.71rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-card-right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.hist-cost {
  font-size: 0.8rem;
  font-weight: 800;
  color: #fbbf24;
  white-space: nowrap;
}

.history-item-card.is-etc .hist-cost {
  color: #c084fc;
}

.btn-hist-del {
  background: transparent;
  border: none;
  color: #64748b;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-hist-del svg {
  width: 13px;
  height: 13px;
}

.btn-hist-del:hover {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.14);
}

.history-empty-txt {
  grid-column: 1 / -1;
  text-align: center;
  padding: 16px 10px;
  font-size: 0.8rem;
  color: #64748b;
}

/* ==========================================================================
   5. 부위별 아이템 등록 / 교체 모달
   ========================================================================== */
.slot-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.72);
  backdrop-filter: blur(4px);
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.slot-modal-dialog {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  background: #151a26;
  border: 1px solid #2c3850;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPopIn 0.16s ease-out;
}

@keyframes modalPopIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.slot-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #19202f;
  border-bottom: 1px solid #263147;
}

.slot-modal-head-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.slot-modal-badge {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 6px;
}

.slot-modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
}

.btn-slot-modal-close {
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-slot-modal-close svg {
  width: 17px;
  height: 17px;
}

.btn-slot-modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.slot-modal-body {
  padding: 18px 20px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 현재 장착 중인 아이템 관리 박스 */
.modal-current-box {
  background: #0f141e;
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 11px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-current-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-current-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.modal-current-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #161d2b;
  border: 1px solid #263147;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-current-thumb img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  image-rendering: pixelated;
}

.modal-current-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.modal-current-tag {
  font-size: 0.68rem;
  font-weight: 800;
  color: #34d399;
}

.modal-current-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: #ffffff;
}

.modal-current-cost {
  font-size: 0.8rem;
  font-weight: 800;
  color: #ff9854;
}

.modal-current-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-cur-edit,
.btn-cur-del {
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
}

.btn-cur-edit {
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

.btn-cur-del {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.32);
  color: #fb7185;
}

.modal-edit-inline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed #243047;
}

.modal-replace-notice {
  font-size: 0.76rem;
  color: #94a3b8;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 8px;
  padding: 8px 11px;
  line-height: 1.4;
}

.modal-replace-notice strong {
  color: #fbbf24;
}

/* 모달 검색 및 추천 아이템 선택 */
.modal-field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.modal-search-wrap {
  position: relative;
}

.modal-search-svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: #64748b;
  pointer-events: none;
}

.modal-text-input {
  width: 100%;
  box-sizing: border-box;
  background: #0c1018;
  border: 1px solid #29354d;
  border-radius: 9px;
  color: #ffffff;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.18s ease;
}

.modal-text-input.with-icon {
  padding-left: 36px;
}

.modal-text-input:focus {
  border-color: var(--primary, #f0883e);
}

.modal-scope-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 7px;
}

.scope-tab-group {
  display: inline-flex;
  gap: 5px;
}

.btn-scope-tab {
  background: #0f141e;
  border: 1px solid #242f44;
  color: #94a3b8;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-scope-tab.active {
  background: rgba(240, 136, 62, 0.14);
  border-color: rgba(240, 136, 62, 0.45);
  color: #ff9854;
}

.modal-pick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 178px;
  overflow-y: auto;
  background: #0e131d;
  border: 1px solid #222c40;
  border-radius: 10px;
  padding: 8px;
}

.modal-pick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #151c2a;
  border: 1px solid #243047;
  color: #e2e8f0;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  min-width: 0;
  transition: all 0.14s ease;
}

.modal-pick-item:hover {
  border-color: #38bdf8;
  background: #1b2436;
}

.modal-pick-item.is-selected {
  border-color: var(--primary, #f0883e);
  background: rgba(240, 136, 62, 0.14);
  color: #ffffff;
}

.modal-pick-item img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.modal-pick-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-custom-item-btn {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px dashed rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.modal-custom-item-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  color: #ffffff;
}

/* 선택된 아이템 미리보기 배너 */
.modal-selected-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #101622;
  border: 1px solid rgba(240, 136, 62, 0.42);
  border-radius: 9px;
  padding: 9px 12px;
}

.selected-preview-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.selected-preview-left img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  image-rendering: pixelated;
}

.selected-preview-name {
  font-size: 0.86rem;
  font-weight: 800;
  color: #ffffff;
}

.selected-preview-cat {
  font-size: 0.72rem;
  color: #ff9854;
  font-weight: 700;
}

/* 시세 입력 & 빠른 금액 칩 */
.modal-price-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-qty-input {
  width: 72px;
  background: #0c1018;
  border: 1px solid #29354d;
  border-radius: 9px;
  color: #ffffff;
  padding: 10px 8px;
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
  outline: none;
}

.modal-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.btn-quick-amt {
  background: #182030;
  border: 1px solid #28354e;
  color: #cbd5e1;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-quick-amt:hover {
  background: #222e46;
  color: #ffffff;
  border-color: #3f5378;
}

.btn-quick-amt.btn-amt-reset:hover {
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.45);
}

.modal-price-korean-hint {
  margin-top: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #38bdf8;
  min-height: 18px;
}

.modal-footer-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid #202a3d;
}

.btn-modal-cancel {
  background: #1b2232;
  border: 1px solid #2e3b54;
  color: #cbd5e1;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-modal-submit {
  background: linear-gradient(180deg, #ff7b54 0%, #f0643b 100%);
  border: 1px solid rgba(255, 160, 122, 0.35);
  color: #ffffff;
  padding: 9px 20px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
}

.btn-modal-submit:hover {
  filter: brightness(1.07);
}

/* 빈 상태 카드 */
.char-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 50px 20px;
  background: #161b26;
  border: 1px dashed #2a354d;
  border-radius: 12px;
  color: #8b949e;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.char-empty-svg {
  width: 38px;
  height: 38px;
  color: #475569;
}

.char-empty-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #e2e8f0;
}

.char-empty-desc {
  margin: 0;
  font-size: 0.84rem;
  color: #8b949e;
}

/* ==========================================================================
   6. 토스트 알림
   ========================================================================== */
.char-toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.char-toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1b2333;
  border: 1px solid #32415c;
  color: #f8fafc;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  animation: toastSlideUp 0.2s ease-out;
  pointer-events: auto;
}

.char-toast.toast-success {
  border-color: rgba(52, 211, 153, 0.45);
  color: #a7f3d0;
}

.char-toast.toast-error {
  border-color: rgba(251, 113, 133, 0.45);
  color: #fecdd3;
}

.char-toast svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

@keyframes toastSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   7. 반응형
   ========================================================================== */
@media (max-width: 1200px) {
  .invest-char-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .drawer-workspace {
    grid-template-columns: 1fr;
  }
  .equip-board-panel {
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
  }
}

@media (max-width: 768px) {
  .invest-char-grid {
    grid-template-columns: 1fr;
  }
  .char-bar-main,
  .char-bar-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 14px;
  }
  .char-add-input-group {
    max-width: 100%;
    min-width: 0;
  }
  .char-kpi-inline {
    width: 100%;
    justify-content: space-between;
    height: auto;
    padding: 9px 14px;
  }
  .char-sort-pills {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .char-sort-pill {
    text-align: center;
    padding: 6px 4px;
  }
  .toolbar-btn-divider {
    display: none;
  }
  .char-export-btn-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
  .char-export-btn-group button {
    padding: 0 6px;
    font-size: 0.74rem;
  }
  .char-card-drawer {
    padding: 14px;
  }
  .equip-slot-grid {
    gap: 6px;
  }
  .equip-slot-tile {
    height: 78px;
  }
  .slot-filled-img {
    width: 28px;
    height: 28px;
  }
  .modal-pick-grid {
    grid-template-columns: 1fr;
  }
  .history-summary-grid {
    grid-template-columns: 1fr;
  }
}