/* 다이아 시세 화면 */
.mk-sub { margin-left: 6px; font-size: 12.5px; font-weight: 500; color: var(--faint); }

/* 위쪽 요약: 칸 사이 1px 선은 배경색으로 (줄이 바뀌어도 선이 맞는다) */
.mk-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.mk-card { padding: 15px 18px; background: var(--surface); min-width: 0; transition: background .12s; }
.mk-card .l { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-card .v { font-size: 22px; font-weight: 750; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-card .s { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-card.key .v { color: var(--accent-strong); }
.mk-card.link { cursor: pointer; }
.mk-card.link:hover { background: var(--surface-2); }
.mk-card.link .s { color: var(--accent-strong); }

.mk-trend { margin-top: 16px; }
.mk-trend .card-head { flex-wrap: wrap; }
.mk-trend .card-head h2 { flex-wrap: wrap; row-gap: 2px; min-width: 0; }
.mk-trend-pick { display: flex; align-items: center; gap: 6px; }
.mk-trend-pick select { width: auto; max-width: 200px; min-height: 34px; padding: 6px 10px; font-size: 13.5px; line-height: 18px; }
.mk-trend .chart-box { margin: 12px 18px 16px; height: 220px; }
.mk-trend-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center; font-size: 13.5px; color: var(--faint); }
.mk-trend-msg.over { background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--muted); }
.mk-trend-tip { margin: -6px 18px 14px; font-size: 12.5px; color: var(--faint); }
.mk-note { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; padding: 12px 2px 16px; font-size: 13px; color: var(--faint); line-height: 1.6; }
.mk-note b { color: var(--muted); }
.mk-note button { background: none; border: 0; color: var(--accent-strong); font-weight: 650; cursor: pointer; padding: 2px 4px; font-size: 13px; border-radius: 6px; }
.mk-note button:hover { background: var(--accent-soft); }

/* 서버 목록 + 고른 서버 */
.mk-body { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.mk-servers { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); display: flex; flex-direction: column; overflow: hidden; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.mk-tools { padding: 14px 14px 12px; display: grid; gap: 10px; border-bottom: 1px solid var(--border); }
.mk-tools input[type=search] { min-height: 38px; }
.mk-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.mk-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 0 11px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; font-size: 13px; font-weight: 550; white-space: nowrap; cursor: pointer; transition: border-color .12s, color .12s, background .12s; }
.mk-chip:hover { border-color: var(--border-strong); color: var(--text); }
.mk-chip.on { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); color: var(--accent-strong); font-weight: 650; }
.mk-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.mk-row label { display: flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.mk-row input[type=number] { width: 104px; min-height: 32px; padding: 4px 8px; font-size: 13.5px; }
.mk-row input[type=checkbox] { margin: 0; }
.mk-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: calc(var(--radius-sm) + 3px); background: var(--surface-2); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.mk-seg::-webkit-scrollbar { display: none; }
.mk-seg button { flex: 0 0 auto; min-height: 28px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.mk-seg button:hover { color: var(--text); }
.mk-seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(24, 22, 16, .08), 0 0 0 1px var(--border); }
[data-theme="dark"] .mk-seg button.on { background: var(--surface-3); box-shadow: none; }
.mk-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.mk-listhead, .mk-srv { display: grid; grid-template-columns: minmax(0, 1fr) 44px 58px 88px; align-items: center; column-gap: 6px; }
.mk-listhead { position: sticky; top: 0; z-index: 1; min-height: 34px; padding: 0 14px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.mk-listhead span:not(:first-child) { text-align: right; }
.mk-srv { width: 100%; min-height: 44px; padding: 9px 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; font-size: 14px; cursor: pointer; transition: background .1s; }
.mk-srv:hover { background: var(--surface-2); }
.mk-srv.sel { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.mk-srv .name { font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-srv .cnt, .mk-srv .qty { text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.mk-srv .price { text-align: right; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mk-srv.none .name, .mk-srv.none .price { color: var(--faint); font-weight: 400; font-size: 13px; }
.mk-bulk { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-strong); vertical-align: 1px; }
.mk .low { color: var(--green); } .mk .high { color: var(--red); }

.mk-detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px 22px 22px; min-width: 0; }
.mk-dtitle { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.mk-dtitle h2 { margin: 0; font-size: 22px; font-weight: 750; }
.mk-dtitle span { color: var(--faint); font-size: 13.5px; }
.mk-dstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px; margin-top: 14px; }
.mk-dstat { min-width: 0; padding: 11px 14px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); }
.mk-dstat span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.mk-dstat b { display: block; margin-top: 1px; font-size: 18px; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-dstat small { display: block; font-size: 11.5px; color: var(--faint); line-height: 1.45; }
.mk-calc { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mk-calc input { width: 120px; min-height: 34px; padding: 5px 9px; font-weight: 650; }
.mk-calc b { color: var(--accent-strong); }
.mk-dtools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 22px 0 10px; flex-wrap: wrap; }
.mk-dtools h3 { margin: 0; font-size: 16px; font-weight: 700; }
.mk-dtools h3 small { font-size: 12.5px; color: var(--faint); font-weight: 400; margin-left: 6px; }
.mk-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.mk table { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 720px; }
.mk th, .mk td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.mk tbody tr:last-child td { border-bottom: 0; }
.mk th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.mk .l { text-align: left; }
.mk td.p { font-weight: 750; font-size: 14.5px; }
.mk tr.best td.p { color: var(--green); }
.mk td.sub { color: var(--muted); }
.mk tr.buy { cursor: pointer; }
.mk tr.buy:hover td { background: var(--surface-2); }
.mk a.go { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 12.5px; font-weight: 650; }
.mk tr.buy:hover a.go, .mk a.go:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.mk-tag { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.mk-tag.t-한방 { background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue); }
.mk-tag.t-분할 { background: color-mix(in srgb, var(--violet) 13%, transparent); color: var(--violet); }
.mk-tag.t-흥정, .mk-tag.t-대량 { background: var(--accent-soft); color: var(--accent-strong); }
.mk-tag.t-대량 { margin-left: 6px; }
.mk-recent { margin-top: 18px; }
.mk-recent summary { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; cursor: pointer; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.mk-recent summary:hover { color: var(--text); }
.mk-recent[open] summary { margin-bottom: 8px; }
.mk-hint { color: var(--faint); text-align: center; padding: 64px 20px; font-size: 14px; }
.mk-hint.sm { padding: 32px 12px; }

/* 정상 가격 범위 설정 */
.mk-modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 18, 12, .42); }
.mk-sheet { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); padding: 22px 24px; box-shadow: var(--shadow); }
.mk-sheet h3 { margin: 0 0 6px; font-size: 17px; }
.mk-sheet-lead { margin: 0 0 12px; font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.mk-sheet label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted); font-size: 14px; cursor: pointer; }
.mk-sheet label:has(input[type=radio]:checked) { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); color: var(--text); }
.mk-sheet input[type=radio] { margin: 0; }
.mk-sheet input[type=number] { width: 110px; min-height: 32px; padding: 4px 9px; }
.mk-sheet .help { font-size: 12.5px; color: var(--faint); margin-top: 8px; }
.mk-sheet .row { display: flex; justify-content: flex-end; margin-top: 16px; }

/* 로그인 전 미리보기: 일부만 보여 주고 나머지는 가린다 */
.mk-preview .mk-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mk-card.masked .v { color: var(--faint); display: flex; align-items: center; gap: 6px; }
.mk-card.masked .v svg { width: 18px; height: 18px; }
.mk-preview-list { position: relative; margin-top: 16px; overflow: hidden; }
.mk-preview-list > .table-wrap { border-bottom: 0; }
.mk-preview-list .table td .lucide, .mk-preview-list .table td svg { width: 14px; height: 14px; vertical-align: -2px; }
.mk-preview-list tr.blurred td { filter: blur(5px); user-select: none; color: var(--muted); }
.mk-unlock { position: absolute; left: 0; right: 0; bottom: 0; height: 62%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 20px;
  background: linear-gradient(to bottom, transparent, var(--surface) 38%); }
.mk-unlock p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.6; }
.mk-unlock p b { color: var(--text); font-size: 15.5px; }
.mk-unlock-actions { display: flex; gap: 8px; }

/* 콘텐츠 폭(화면 − 왼쪽 메뉴 248px − 여백)에 맞춘다: 두 칸은 매물 표가 다 들어갈 때만 */
@media (min-width: 1600px) {
  .mk-body { grid-template-columns: 380px minmax(0, 1fr); }
}
@media (max-width: 1439px) {
  .mk-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mk-body { grid-template-columns: minmax(0, 1fr); }
  .mk-servers { position: static; max-height: 440px; }
}
@media (max-width: 767px) {
  .mk-summary, .mk-preview .mk-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mk-card { padding: 12px 14px; }
  .mk-card .v { font-size: 19px; }
  .mk-trend .chart-box { margin: 10px 10px 12px; height: 200px; }
  .mk-trend-pick { width: 100%; }
  .mk-trend-pick select { flex: 1; max-width: none; min-height: 38px; }
  .mk-trend-tip { margin: -4px 12px 12px; }
  .mk-tools { padding: 12px; }
  .mk-groups { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .mk-groups::-webkit-scrollbar { display: none; }
  .mk-chip { min-height: 34px; padding: 0 13px; }
  .mk-seg button { min-height: 32px; }
  .mk-srv { min-height: 48px; }
  .mk-detail { padding: 16px; }
  .mk-dtitle h2 { font-size: 20px; }
  .mk-dtools h3 small { display: block; margin: 2px 0 0; }
  .mk-seg#mkDtype { width: 100%; }
  .mk-seg#mkDtype button { flex: 1 0 auto; }
  /* 매물 표는 카드로: [1만당 · 구매] [수량 · 방식] [결제 금액 · 등록] [설명] */
  .mk-table-wrap:has(.mk-buys) { border: 0; overflow: visible; }
  .mk table.mk-buys { min-width: 0; table-layout: auto; }
  .mk-buys colgroup, .mk-buys thead { display: none; }
  .mk-buys, .mk-buys tbody { display: block; }
  .mk-buys tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "p go" "q t" "pay ago" "sub sub"; gap: 3px 10px; margin-bottom: 8px; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
  .mk-buys tr.best { border-color: color-mix(in srgb, var(--green) 40%, var(--border)); }
  .mk .mk-buys td { display: block; padding: 0; border: 0; text-align: left; font-size: 13px; }
  .mk-buys td:nth-child(1) { grid-area: p; font-size: 16px; }
  .mk-buys td:nth-child(2) { grid-area: q; }
  .mk-buys td:nth-child(3) { grid-area: t; text-align: right; }
  .mk-buys td:nth-child(4) { grid-area: pay; color: var(--muted); }
  .mk-buys td:nth-child(5) { grid-area: sub; white-space: normal; font-size: 12.5px; color: var(--faint); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .mk-buys td:nth-child(6) { grid-area: ago; text-align: right; font-size: 12px; color: var(--faint); }
  .mk-buys td:nth-child(7) { grid-area: go; text-align: right; }
  .mk-buys tr.buy:hover td { background: none; }
  .mk-buys tr.buy:hover { background: var(--surface-2); }
  .mk table.mk-trades { min-width: 520px; }
  .mk-trades th, .mk-trades td { padding: 8px; }
  .mk-sheet { padding: 18px 16px; }
}
@media (max-width: 479px) {
  .mk-listhead, .mk-srv { grid-template-columns: minmax(0, 1fr) 46px 88px; }
  .mk-listhead > :nth-child(3), .mk-srv .qty { display: none; }
  .mk-listhead, .mk-srv { padding-left: 12px; padding-right: 12px; }
}
