:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
}

:root[data-theme='dark'] {
  --bg: #0b1220;
  --panel: #0f172a;
  --ink: #e5e7eb;
  --muted: #94a3b8;
  --line: #334155;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.theme-toggle {
  position: fixed;
  right: 14px;
  bottom: 18px;
  z-index: 90;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
}

.global-bottom {
  margin: 10px auto 24px;
  max-width: 1120px;
  padding: 10px 16px;
  color: #94a3b8;
  font-size: 12px;
  text-align: center;
  line-height: 1.5;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px;
}

.app-loading .wrap {
  visibility: hidden;
}
.app-skeleton {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 12px;
}
.sk-row,
.sk-card {
  border-radius: 14px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f8fafc 37%, #e2e8f0 63%);
  background-size: 400% 100%;
  animation: sk-shimmer 1.2s ease-in-out infinite;
}
.sk-row { height: 42px; }
.sk-card { height: 120px; }
.sk-card.tall { height: 420px; }
@keyframes sk-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
:root[data-theme='dark'] .sk-row,
:root[data-theme='dark'] .sk-card {
  background: linear-gradient(90deg, #1e293b 25%, #0f172a 37%, #1e293b 63%);
  background-size: 400% 100%;
}

.page-head h1 { margin: 4px 0 12px; font-size: 22px; }

.hidden { display: none !important; }

.top-row { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px; }
.mode-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}
.auth-area { display:flex; align-items:center; gap:6px; }
.auth-user { display:flex; align-items:center; gap:8px; font-size:13px; color:#334155; }
.auth-user > span { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-avatar { width:24px; height:24px; border-radius:999px; background:#e2e8f0; }
.btn-primary,.btn-ghost { border:1px solid var(--line); border-radius:999px; padding:7px 11px; font-weight:700; background:#fff; }
.btn-primary { border-color:#0f172a; color:#0f172a; }
.icon-login-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  border-color: transparent;
}
.login-popover-wrap { position: relative; }
.login-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
  padding: 6px;
}
.login-popover-btn {
  white-space: nowrap;
}

.auth-menu-toggle {
  border: 0;
  background: transparent;
  color: #334155;
  font-weight: 700;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-user { position: relative; }
.auth-menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 168px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(15,23,42,.12);
  padding: 6px;
  z-index: 50;
}
.auth-menu-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: #334155;
}
.auth-menu-item:hover { background: #f8fafc; }
.auth-menu-item.danger { color: #b91c1c; font-weight: 700; }
.mode-tabs button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  color: #64748b;
}
.mode-tabs button.active {
  color: #0f172a;
  border-color: #0f172a;
}

.matchup-form label {
  display: block;
  font-size: 13px;
  color: #475569;
  margin-bottom: 8px;
  font-weight: 700;
}
.matchup-input-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.matchup-input-wrap input {
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0 12px;
  font-size: 15px;
}
.matchup-input-wrap button {
  height: 44px;
  border: 1px solid #0f172a;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  font-weight: 700;
  padding: 0 14px;
}
.matchup-type-tabs {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.matchup-type-tabs button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  color: #64748b;
}
.matchup-type-tabs button.active {
  color: #0f172a;
  border-color: #0f172a;
}

.matchup-status {
  margin: 10px 2px;
  font-size: 13px;
  color: #475569;
}
.matchup-list .candidate-item {
  padding: 12px;
}
.matchup-section {
  list-style: none;
  margin: 10px 2px 6px;
}
.matchup-section-title {
  font-size: 13px;
  font-weight: 800;
}
.matchup-section-title.tone-up { color: #b91c1c; }
.matchup-section-title.tone-down { color: #1d4ed8; }
.matchup-section-title.tone-flat { color: #334155; }
.matchup-kpis {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.matchup-kpis span {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 4px 8px;
}

.panel, .search-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}

#secCandidates {
  padding-left: 10px;
  padding-right: 10px;
}

.ad-slot {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  margin: 10px 0;
  overflow: hidden;
}
.ad-slot-middle {
  padding: 6px 8px;
}
.ad-slot-bottom { margin-bottom: 8px; }
.price-with-side-ads { position: relative; }
.price-main-content { min-width: 0; }
.ad-slot-side { display: none; }

@media (min-width: 1280px) {
  .price-with-side-ads.ads-enabled {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr) 200px;
    gap: 14px;
    align-items: start;
  }
  .price-with-side-ads.ads-enabled .ad-slot-side:not(.hidden) {
    display: block;
    position: sticky;
    top: 12px;
    min-height: 600px;
  }
  #secCandidates {
    margin-bottom: 0;
  }
  .ad-slot-bottom {
    margin-top: 12px;
  }
}

.search-input-wrap {
  position: relative;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 16px;
  pointer-events: none;
}
.search-box input {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0 12px 0 36px;
  font-size: 15px;
}

.selected-player-meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

#selectedSeasonImg { display: none; }

.suggest-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: auto;
  max-height: min(46vh, 360px);
  display: none;
}
.suggest-list.show { display: block; }
.suggest-list::-webkit-scrollbar { width: 8px; }
.suggest-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
.suggest-list li {
  border-bottom: 0;
  cursor: pointer;
  font-size: 14px;
  background: transparent;
}
.suggest-list li:hover { background: transparent; }
.suggest-list li.suggest-as-candidate {
  margin-bottom: 10px;
}
.suggest-list li.suggest-as-candidate:last-child { margin-bottom: 0; }
.suggest-list li.suggest-as-candidate:hover { background: transparent; }
.suggest-main,
.suggest-top {
  font-weight: 700;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.suggest-card { display: grid; gap: 4px; }
.suggest-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.suggest-price {
  font-size: 12px;
  color: #0f172a;
  font-weight: 700;
}
.suggest-extra {
  margin-top: 2px;
  font-size: 12px;
  color: #0f172a;
  font-weight: 700;
}
.suggest-face {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
  object-position: center top;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.suggest-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}
.suggest-strength {
  font-size: 12px;
  color: #334155;
  font-weight: 700;
  white-space: nowrap;
  flex: 0 0 auto;
}
.suggest-season-img {
  flex: 0 0 auto;
}
.suggest-sub {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  display: block;
}

.suggest-season-img,
.top-season-badge {
  width: 34px;
  height: 16px;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: block;
  flex: 0 0 auto;
}

.candidate-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.dev-sync-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 12px;
  color: #334155;
}

.price-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 2px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}
.filter-chip.active {
  color: #0f172a;
  border-color: #0f172a;
}
.filter-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

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

.rank-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin: 0 0 10px;
  overflow-x: auto;
}
.rank-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 10px 8px;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
}
.rank-tabs button.active {
  color: #0f172a;
  border-bottom-color: #0f172a;
}
.rank-slider-wrap { overflow: hidden; }
.candidate-list-scroll {
  height: 840px; /* 기존 체감 높이 대비 2배 고정 */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding-right: 2px;
}
.candidate-list-scroll::-webkit-scrollbar { width: 8px; }
.candidate-list-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
.rank-switch-left,
.rank-switch-right {
  animation-duration: .22s;
  animation-timing-function: ease;
}
.rank-switch-left { animation-name: rankSlideLeft; }
.rank-switch-right { animation-name: rankSlideRight; }
@keyframes rankSlideLeft {
  from { opacity: 0.35; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes rankSlideRight {
  from { opacity: 0.35; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
.rank-slider {
  display: flex;
  width: 200%;
  transform: translateX(0%);
  transition: transform .22s ease;
}
.rank-slide { width: 50%; flex: 0 0 50%; }
.rank-single { width: 100%; flex: 1 1 auto; }
.subpanel { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.subpanel-buy { border: 0; }
.subpanel h3 { margin: 0 0 10px; font-size: 15px; }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.candidate-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}
.candidate-clickable { cursor: pointer; }
.candidate-clickable:hover { background: #f8fafc; border-color: #cbd5e1; }

.candidate-row-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.candidate-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tone-chip {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  line-height: 1.25;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tone-up { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.tone-down { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.tone-shock { background: #fce7f3; color: #9d174d; border-color: #fbcfe8; }
.tone-flat { background: #e5e7eb; color: #374151; border-color: #d1d5db; }

.candidate-row-sub {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "meta media"
    "price media"
    "expected media";
  gap: 6px 12px;
  font-size: 12px;
  align-items: center;
  min-height: 102px;
}
.candidate-meta {
  grid-area: meta;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}
.candidate-media {
  grid-area: media;
  justify-self: end;
  align-self: center;
  width: 92px;
  height: 92px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  background: #f8fafc;
}
.candidate-face {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transform: scale(1.12) translateY(2%);
  transform-origin: center top;
}
.candidate-price { grid-area: price; font-weight: 700; color: #0f172a; }
.candidate-expected {
  grid-area: expected;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.side-pill,
.gap-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.25;
  font-weight: 800;
  border: 1px solid transparent;
  vertical-align: middle;
}
.side-buy { background: #ecfdf5; color: #166534; border-color: #86efac; }
.side-sell { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
.side-hold { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
.tier-pill { display:inline-flex; align-items:center; padding:1px 7px; border-radius:999px; font-size:10px; font-weight:800; border:1px solid transparent; }
.tier-strong { background:#ecfdf5; color:#166534; border-color:#86efac; }
.tier-normal { background:#fffbeb; color:#92400e; border-color:#fcd34d; }
.tier-observe { background:#f1f5f9; color:#475569; border-color:#cbd5e1; }
.demand-pill {
  display:inline-flex;
  align-items:center;
  padding:1px 7px;
  border-radius:999px;
  font-size:10px;
  line-height:1.25;
  font-weight:800;
  border:1px solid #bfdbfe;
  background:#eff6ff;
  color:#1d4ed8;
}
.gap-tight { background: #ecfdf5; color: #166534; border-color: #86efac; }
.gap-mid { background: #fffbeb; color: #92400e; border-color: #fcd34d; }
.gap-wide { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
.gap-neutral { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }

.price-chart {
  width: 100%; min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  position: relative;
}
.price-chart svg { width: 100%; height: 260px; display: block; }
.price-chart.chart-empty svg { filter: blur(2px) saturate(0.7); opacity: 0.7; }
.chart-placeholder {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  color: #0f172a; font-weight: 700; font-size: 16px; z-index: 4; backdrop-filter: blur(2px);
}
.chart-tooltip {
  position: absolute; display: none; pointer-events: none;
  background: rgba(15, 23, 42, 0.92); color: #f8fafc;
  border-radius: 8px; padding: 6px 8px; font-size: 12px; line-height: 1.3; z-index: 3; white-space: nowrap;
}

.regime-diagnostics, .chart-insight { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.diag-chip { font-size: 12px; padding: 5px 9px; border-radius: 999px; border: 1px solid #cbd5e1; background: #f8fafc; color: #334155; }
.diag-regime { background: #eef2ff; border-color: #c7d2fe; }
.diag-shock { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.diag-steady { background: #ecfeff; border-color: #a5f3fc; color: #0f766e; }
.diag-bias { background: #fefce8; border-color: #fde68a; color: #854d0e; }
.chart-pill { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 999px; padding: 4px 8px; font-size: 13px; }

.quality-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.qm-item { border: 1px solid #e2e8f0; border-radius: 10px; padding: 8px; background: #f8fafc; }
.qm-item span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.qm-item strong { font-size: 14px; color: #0f172a; }

.modal { display: none; }
.modal.open { display: block; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 40; }
.modal-sheet {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: min(760px, 100%); height: 88vh; max-height: 88vh;
  overflow: hidden;
  background: #fff; border-radius: 16px 16px 0 0; z-index: 41; box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.2);
}
.modal-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 10px 12px 8px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.modal-head button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 10px; }
.modal-close-x {
  width: 36px;
  height: 36px;
  border-radius: 999px !important;
  padding: 0 !important;
  font-size: 18px;
  line-height: 1;
}
.modal-body {
  padding: 6px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: calc(88vh - 62px - 44px);
  overflow-y: auto;
}
.modal-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin: 0;
  padding: 0 12px;
  overflow-x: auto;
  background: #fff;
}
.modal-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
}
.modal-tabs button.active { color: #0f172a; border-bottom-color: #0f172a; }
.modal-tab-pane { display: none; padding-top: 10px; }
.modal-tab-pane.active { display: block; }
.modal-body[data-tab-dir="left"] .modal-tab-pane.active {
  animation: modalTabInLeft .22s ease;
}
.modal-body[data-tab-dir="right"] .modal-tab-pane.active {
  animation: modalTabInRight .22s ease;
}
@keyframes modalTabInLeft {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes modalTabInRight {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}
.modal-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.modal-kpis > div { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #f8fafc; }
.modal-kpis span { color: var(--muted); font-size: 12px; display: block; }
.modal-kpis strong { font-size: 15px; }
.decision-topline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.decision-topline > div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #f8fafc;
}
.decision-topline span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 2px;
}
.gap-note {
  display: block;
  margin-top: 4px;
  font-style: normal;
  color: #64748b;
  font-size: 12px;
}
.decision-kpi strong { font-size: 22px; font-weight: 900; }
.current-kpi strong { font-size: 22px; font-weight: 900; }
.decision-kpi.decision-buy { background: #ecfdf5; border-color: #86efac; }
.decision-kpi.decision-buy strong { color: #166534; }
.decision-kpi.decision-hold { background: #f8fafc; border-color: #cbd5e1; }
.decision-kpi.decision-hold strong { color: #334155; }
.decision-kpi.decision-sell { background: #fef2f2; border-color: #fca5a5; }
.decision-kpi.decision-sell strong { color: #991b1b; }

.exec-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.exec-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}
.exec-item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}
.exec-item strong {
  font-size: clamp(18px, 5.2vw, 22px);
  font-weight: 900;
  color: #0f172a;
  white-space: nowrap;
  letter-spacing: -0.2px;
}
.exec-expect {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #f8fafc;
  font-size: 13px;
  color: #334155;
  position: relative;
}
.expect-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.info-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  padding: 0;
}
.expect-tooltip {
  display: none;
  margin-top: 8px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  line-height: 1.4;
}
.exec-expect.show-tip .expect-tooltip { display: block; }
.exec-expect strong {
  color: #0f172a;
  font-size: 16px;
}
.exec-expect span {
  margin-left: 6px;
  color: #64748b;
}
.modal-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.compact-kpis { grid-template-columns: repeat(2, 1fr); }
#modalTabDecision .decision-topline { margin-top: 0; margin-bottom: 10px; }
#modalTabDecision .exec-strip { margin-bottom: 10px; }
#modalTabDecision .panel { margin-top: 10px; }
.modal-body h3 { margin: 0 0 6px; font-size: 14px; }
.modal-body p { margin: 0; font-size: 13px; color: #334155; line-height: 1.4; }
#mReason { white-space: pre-line; }
.auth-notice { font-size:12px; color:#475569; margin-bottom:8px; }
.asset-form,.trade-form { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:8px; }
.asset-form button,.trade-form button { grid-column: span 2; height:38px; border:1px solid #0f172a; background:#0f172a; color:#fff; border-radius:8px; font-weight:700; }
.asset-form input,.trade-form input,.trade-form select { height:36px; border:1px solid var(--line); border-radius:8px; padding:0 10px; }
.asset-chart { margin-top:10px; min-height:160px; border:1px solid var(--line); border-radius:10px; background:#fff; padding:8px; }
.asset-empty { color:#94a3b8; font-size:13px; padding:16px 6px; }
.mini-hint { margin-top:6px; font-size:12px; color:#64748b; }
.asset-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.asset-summary-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #f8fafc;
}
.asset-summary-item span {
  display: block;
  font-size: 12px;
  color: #64748b;
}
.asset-summary-item strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  color: #0f172a;
}
.asset-summary-item.total {
  grid-column: 1 / -1;
}
.asset-insight-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.asset-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: #eef2ff;
  color: #1e293b;
}
.asset-badge.good {
  background: #e8fff1;
  color: #166534;
  border-color: #86efac;
}
.asset-badge.warn {
  background: #fff1f2;
  color: #9f1239;
  border-color: #fda4af;
}
.asset-badge.neutral {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

.trade-record-item {
  padding: 10px 12px;
}
.trade-record-main {
  min-width: 0;
}
.trade-record-head {
  font-weight: 800;
  margin-bottom: 4px;
}
.trade-record-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 12px;
  margin-bottom: 4px;
}
.trade-record-sub {
  font-size: 13px;
  color: #334155;
  margin-top: 2px;
}
.trade-diff {
  font-weight: 800;
  margin-left: 6px;
}
.trade-diff.up {
  color: #15803d;
}
.trade-diff.down {
  color: #be123c;
}
.trade-diff.flat {
  color: #64748b;
}
.trade-record-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.trade-record-media {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  background: #f8fafc;
}
.trade-record-media .candidate-face {
  width: 100%;
  height: 100%;
  transform: none;
  object-fit: cover;
}
.trade-record-actions {
  display: inline-flex;
  gap: 6px;
  margin-left: 8px;
}
.trade-icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
}
.records-pager {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.records-pager .btn-ghost {
  padding: 6px 10px;
}
#recordsPageInfo {
  font-size: 12px;
  color: #64748b;
  min-width: 72px;
  text-align: center;
}

#tradeEditModal .modal-sheet {
  width: min(520px, 100%);
}

@media (min-width: 900px) {
  .rank-grid { grid-template-columns: 1fr 1fr; }
  .modal-sheet {
    top: 50%; bottom: auto; transform: translate(-50%, -50%);
    border-radius: 16px; height: min(88vh, 920px); max-height: min(88vh, 920px);
  }
  .modal-body {
    height: calc(min(88vh, 920px) - 62px - 44px);
  }
}

:root[data-theme='dark'] .btn-primary,
:root[data-theme='dark'] .btn-ghost,
:root[data-theme='dark'] .mode-tabs button,
:root[data-theme='dark'] .filter-chip,
:root[data-theme='dark'] .rank-tabs button,
:root[data-theme='dark'] .auth-menu-dropdown,
:root[data-theme='dark'] .auth-menu-item,
:root[data-theme='dark'] .modal-head,
:root[data-theme='dark'] .modal-tabs,
:root[data-theme='dark'] .modal-sheet,
:root[data-theme='dark'] .exec-item,
:root[data-theme='dark'] .candidate-item,
:root[data-theme='dark'] .asset-chart,
:root[data-theme='dark'] .panel,
:root[data-theme='dark'] .search-box,
:root[data-theme='dark'] .subpanel {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

:root[data-theme='dark'] .price-chart {
  background: #1f2937;
  border-color: #475569;
}

:root[data-theme='dark'] .candidate-clickable:hover,
:root[data-theme='dark'] .auth-menu-item:hover {
  background: #17243a;
}

:root[data-theme='dark'] .dev-sync-panel,
:root[data-theme='dark'] .exec-expect,
:root[data-theme='dark'] .modal-kpis > div,
:root[data-theme='dark'] .qm-item,
:root[data-theme='dark'] .decision-topline > div,
:root[data-theme='dark'] .exec-item,
:root[data-theme='dark'] .asset-summary-item {
  background: #111c31;
  border-color: var(--line);
}

:root[data-theme='dark'] input,
:root[data-theme='dark'] select,
:root[data-theme='dark'] textarea {
  background: #0b1220;
  color: var(--ink);
  border-color: var(--line);
}

:root[data-theme='dark'] input::placeholder,
:root[data-theme='dark'] textarea::placeholder {
  color: #8aa0bd;
}

:root[data-theme='dark'] .modal-tabs button.active,
:root[data-theme='dark'] .rank-tabs button.active,
:root[data-theme='dark'] .mode-tabs button.active {
  color: #f8fafc;
  border-bottom-color: #93c5fd;
}

:root[data-theme='dark'] .exec-item strong,
:root[data-theme='dark'] .exec-expect strong,
:root[data-theme='dark'] .current-kpi strong,
:root[data-theme='dark'] .decision-kpi strong,
:root[data-theme='dark'] .candidate-price,
:root[data-theme='dark'] .candidate-expected,
:root[data-theme='dark'] .qm-item strong,
:root[data-theme='dark'] .modal-kpis strong,
:root[data-theme='dark'] .asset-summary-item strong {
  color: #f8fafc;
}

:root[data-theme='dark'] .modal-body p,
:root[data-theme='dark'] .mini-hint,
:root[data-theme='dark'] .auth-notice,
:root[data-theme='dark'] .gap-note,
:root[data-theme='dark'] #mReason,
:root[data-theme='dark'] #mRisk,
:root[data-theme='dark'] .exec-expect span,
:root[data-theme='dark'] .qm-item span,
:root[data-theme='dark'] .modal-kpis span,
:root[data-theme='dark'] .trade-record-meta,
:root[data-theme='dark'] .trade-record-sub,
:root[data-theme='dark'] #recordsPageInfo,
:root[data-theme='dark'] .asset-summary-item span {
  color: #b7c6da;
}
:root[data-theme='dark'] .asset-badge {
  background: #1a2740;
  color: #dbeafe;
  border-color: #334155;
}
:root[data-theme='dark'] .asset-badge.good {
  background: #0f2a1e;
  color: #86efac;
  border-color: #166534;
}
:root[data-theme='dark'] .asset-badge.warn {
  background: #2f1220;
  color: #fda4af;
  border-color: #881337;
}
:root[data-theme='dark'] .asset-badge.neutral {
  background: #1e293b;
  color: #cbd5e1;
  border-color: #475569;
}
:root[data-theme='dark'] .trade-diff.up {
  color: #4ade80;
}
:root[data-theme='dark'] .trade-diff.down {
  color: #fb7185;
}
:root[data-theme='dark'] .trade-diff.flat {
  color: #94a3b8;
}

:root[data-theme='dark'] .trade-icon-btn {
  background: #111c31;
  color: #e5e7eb;
  border-color: #334155;
}

:root[data-theme='dark'] #regimeDiagnostics,
:root[data-theme='dark'] #chartInsight {
  color: #dbeafe;
}

:root[data-theme='dark'] .chart-pill,
:root[data-theme='dark'] #chartInsight .chart-pill {
  background: #111c31;
  border-color: #334155;
  color: #dbeafe;
}

:root[data-theme='dark'] .diag-chip,
:root[data-theme='dark'] #regimeDiagnostics .diag-chip {
  color: #dbeafe;
  border-color: #334155;
  background: #111c31;
}

:root[data-theme='dark'] .diag-regime {
  background: #1e3a8a;
  border-color: #60a5fa;
  color: #eff6ff;
}

:root[data-theme='dark'] .diag-steady {
  background: #065f46;
  border-color: #34d399;
  color: #ecfdf5;
}

:root[data-theme='dark'] .diag-shock {
  background: #9f1239;
  border-color: #fb7185;
  color: #fff1f2;
}

:root[data-theme='dark'] .diag-bias {
  background: #92400e;
  border-color: #fbbf24;
  color: #fffbeb;
}

:root[data-theme='dark'] .price-chart svg text {
  fill: #cbd5e1 !important;
}

:root[data-theme='dark'] .global-bottom { color: #94a3b8; }

@media (max-width: 520px) {
  .wrap { padding: 10px; }
  .candidate-list-scroll { height: 620px; }
  .top-row { align-items:center; justify-content:space-between; }
  .auth-area { justify-content:flex-end; }
  .auth-user { gap: 6px; font-size: 12px; }
  .auth-avatar { width: 22px; height: 22px; }
  .auth-user .btn-ghost { padding: 6px 10px; }
  .mode-tabs button { padding: 8px 12px; }
  .asset-form,.trade-form { grid-template-columns: 1fr; }
  .asset-form button,.trade-form button { grid-column: span 1; }
  .matchup-input-wrap {
    grid-template-columns: 1fr;
  }
  .matchup-input-wrap button {
    width: 100%;
  }
  .page-head h1 { font-size: 20px; }
  .candidate-head { align-items: center; }
  .rank-tabs button { font-size: 13px; }
  .candidate-head h2 { font-size: 16px; }
  .suggest-list {
    max-height: 42vh;
  }
  .suggest-list li { }
  .quality-metrics { grid-template-columns: 1fr; }

  #secCandidates {
    padding-left: 6px;
    padding-right: 6px;
  }
  .subpanel {
    padding-left: 4px;
    padding-right: 4px;
  }
  .candidate-item {
    padding: 12px;
  }
}
