/* 거래내역 '한눈에 보기' (2026-11-03) — 그림은 MockHistoryAnalysis.js 가 그린다.
   색 규칙: 매수·이익 = 빨강, 매도·손실 = 파랑 (앱 공통) · 글자 최소 13px · 테마는 --mo-* / --mh-* 를 따른다 */
.mh {
    --mha-buy: #e02424;
    --mha-sell: #2a63e0;
}
:root:not([data-theme="light"]) .mh {
    --mha-buy: #ff6b6b;
    --mha-sell: #6aa8ff;
}

.mha {
    --mha-card: var(--mh-card, var(--mo-surface));
    --mha-line: var(--mh-line, var(--mo-line));
    --mha-text: var(--mh-text, var(--mo-text));
    --mha-text-2: var(--mh-text-2, var(--mo-text-2));
    --mha-text-3: var(--mh-text-3, var(--mo-text-3));
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 22px 18px;
    color: var(--mha-text);
    font-variant-numeric: tabular-nums;
}
.mha[hidden] { display: none; }

.mha-empty { display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; height: 100%; text-align: center; color: var(--mha-text-2); font-size: 14px; }
.mha-empty strong { font-size: 17px; color: var(--mha-text); }

.mha-insight { margin: 4px 0 12px; font-size: 15px; line-height: 1.55; color: var(--mha-text-2); }
.mha-insight b { color: var(--mha-text); font-weight: 700; }
.mha-insight em { font-style: normal; font-weight: 800; }
.mha-sep { margin: 0 4px; color: var(--mha-text-3); }

.mha-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 12px; }
.mha-kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 13px 16px; border: 1px solid var(--mha-line); border-radius: 12px; background: var(--mha-card); min-width: 0; }
.mha-kpi-l { font-size: 13px; color: var(--mha-text-2); }
.mha-kpi-v { font-size: 24px; font-weight: 800; letter-spacing: -.3px; line-height: 1.25; color: var(--mha-text); }
.mha-kpi-s { font-size: 13px; color: var(--mha-text-3); }

.mha-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.mha-card { min-width: 0; padding: 14px 16px; border: 1px solid var(--mha-line); border-radius: 12px; background: var(--mha-card); }
.mha-card--wide { grid-column: 1 / -1; }
.mha-h { margin: 0 0 10px; font-size: 15px; font-weight: 700; color: var(--mha-text); }
.mha-h-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.mha-h-row .mha-h { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mha-note { margin: 10px 0 0; font-size: 13px; color: var(--mha-text-3); }
.mha-plot { min-width: 0; }
.mha-plot svg { display: block; max-width: 100%; }

.mha-sel { max-width: 200px; height: 32px; padding: 0 8px; border: 1px solid var(--mha-line); border-radius: 8px; background: var(--mha-card); color: var(--mha-text); font-size: 13px; }
.mha-sel option { background: var(--mha-card); color: var(--mha-text); }

/* 범례 */
.mha-legend { display: flex; gap: 14px; margin-bottom: 6px; font-size: 13px; color: var(--mha-text-2); }
.mha-k.is-buy { color: var(--mha-buy); font-weight: 700; }
.mha-k.is-sell { color: var(--mha-sell); font-weight: 700; }
.mha-k.is-line::before { content: ""; display: inline-block; width: 16px; height: 2px; margin-right: 5px; vertical-align: middle; background: var(--mha-text-3); }

/* 차트 공통 */
.mha-ax { font-size: 13px; fill: var(--mha-text-3); }
.mha-grid-l { stroke: var(--mha-line); stroke-width: 1; }
.mha-zero { stroke: var(--mha-text-3); stroke-width: 1; }
.mha-cross { stroke: var(--mha-text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.mha-dot { fill: var(--mha-text); stroke: var(--mha-card); stroke-width: 2; }
.mha-s-up { stop-color: var(--mha-buy); }
.mha-s-dn { stop-color: var(--mha-sell); }
.mha-close { fill: none; stroke: var(--mha-text-3); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; opacity: .55; }
.mha-mark { cursor: default; }
.mha-mark polygon { stroke: var(--mha-card); stroke-width: 2; paint-order: stroke; stroke-linejoin: round; }
.mha-mark polygon.is-buy { fill: var(--mha-buy); }
.mha-mark polygon.is-sell { fill: var(--mha-sell); }
.mha-col.is-buy { fill: var(--mha-buy); }
.mha-col.is-sell { fill: var(--mha-sell); }

.mha-tip { position: absolute; z-index: 5; display: flex; flex-direction: column; gap: 2px; min-width: 110px; padding: 8px 11px; border: 1px solid var(--mha-line); border-radius: 8px; background: var(--mo-bg); box-shadow: 0 6px 20px rgba(0, 0, 0, .3); font-size: 13px; color: var(--mha-text); pointer-events: none; white-space: nowrap; }
.mha-tip[hidden] { display: none; }
.mha-tip i { font-style: normal; color: var(--mha-text-3); }

/* 손익 달력 */
.mha-cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.mha-cal-title { font-size: 14px; font-weight: 700; }
.mha-cal-sum { margin-left: auto; font-size: 14px; font-weight: 800; }
.mha-cal-nav { width: 28px; height: 28px; border: 1px solid var(--mha-line); border-radius: 7px; background: transparent; color: var(--mha-text-2); font-size: 15px; cursor: pointer; }
.mha-cal-nav:disabled { opacity: .35; cursor: default; }
.mha-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mha-cal-w { padding-bottom: 2px; font-size: 13px; text-align: center; color: var(--mha-text-3); }
.mha-day { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 42px; padding: 2px; border: 1px solid transparent; border-radius: 7px; background: transparent; font: inherit; color: var(--mha-text); min-width: 0; overflow: hidden; }
.mha-day i { font-style: normal; font-size: 13px; line-height: 1.2; color: var(--mha-text-2); }
.mha-day b { font-size: 13px; line-height: 1.2; font-weight: 700; white-space: nowrap; min-height: 14px; }
.mha-day.is-none i { color: var(--mha-text-3); opacity: .6; }
button.mha-day { cursor: pointer; background: color-mix(in srgb, var(--mha-text-3) 10%, transparent); }
button.mha-day.is-up { background: color-mix(in srgb, var(--mha-buy) var(--mha-a), transparent); }
button.mha-day.is-dn { background: color-mix(in srgb, var(--mha-sell) var(--mha-a), transparent); }
button.mha-day:hover { border-color: var(--mha-text-3); }
button.mha-day.is-sel { border-color: var(--mha-text); box-shadow: inset 0 0 0 1px var(--mha-text); }
.mha-day-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--mha-text-3); vertical-align: middle; }

/* 종목별 손익 */
.mha-bars { display: flex; flex-direction: column; gap: 2px; }
.mha-bar-row { display: grid; grid-template-columns: minmax(70px, 34%) minmax(0, 1fr) 66px; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 2px 6px; border: 0; border-radius: 7px; background: transparent; font: inherit; font-size: 13px; color: var(--mha-text); text-align: left; }
button.mha-bar-row { cursor: pointer; }
button.mha-bar-row:hover { background: color-mix(in srgb, var(--mha-text-3) 12%, transparent); }
.mha-bar-row.is-sel { background: color-mix(in srgb, var(--mha-text-3) 20%, transparent); }
.mha-bar-row.is-rest { color: var(--mha-text-3); }
.mha-bar-nm { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mha-bar-track { position: relative; display: block; height: 14px; }
.mha-bar-track::before { content: ""; position: absolute; top: -4px; bottom: -4px; left: 50%; width: 1px; background: var(--mha-text-3); opacity: .6; }
.mha-bar { position: absolute; top: 0; bottom: 0; min-width: 2px; }
.mha-bar.is-up { left: 50%; background: var(--mha-buy); border-radius: 0 4px 4px 0; }
.mha-bar.is-dn { right: 50%; background: var(--mha-sell); border-radius: 4px 0 0 4px; }
.mha-bar-row.is-rest .mha-bar { opacity: .5; }
.mha-bar-v { font-weight: 700; text-align: right; white-space: nowrap; }

/* 자산별 */
.mha-assets { display: flex; flex-direction: column; gap: 14px; }
.mha-asset-top { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.mha-asset-top span { font-size: 13px; color: var(--mha-text-3); }
.mha-asset-top em { margin-left: auto; font-style: normal; font-weight: 800; }
.mha-asset-top em.mha-asset-none { font-size: 13px; font-weight: 400; color: var(--mha-text-3); }
.mha-meter { display: block; height: 8px; margin: 6px 0 4px; border-radius: 4px; background: color-mix(in srgb, var(--mha-text-3) 18%, transparent); overflow: hidden; }
.mha-meter i { display: block; min-width: 3px; height: 100%; border-radius: 4px; background: var(--mha-text-2); }
.mha-asset-sub { font-size: 13px; color: var(--mha-text-3); }

/* 체결 내역 */
.mha-clear { height: 30px; padding: 0 11px; border: 1px solid var(--mha-line); border-radius: 8px; background: transparent; color: var(--mha-text-2); font-size: 13px; cursor: pointer; }
.mha-feed { margin: 0; padding: 0; list-style: none; }
.mha-fill { display: grid; grid-template-columns: 70px 92px minmax(120px, 1fr) minmax(130px, auto) 112px 104px; align-items: center; gap: 10px; min-height: 40px; padding: 3px 10px; border-bottom: 1px solid var(--mha-line); border-left: 3px solid transparent; font-size: 14px; }
.mha-fill:last-child { border-bottom: 0; }
.mha-fill.is-buy { border-left-color: var(--mha-buy); }
.mha-fill.is-sell { border-left-color: var(--mha-sell); }
.mha-fill-side { justify-self: start; padding: 2px 7px; border-radius: 6px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.mha-fill.is-buy .mha-fill-side { color: var(--mha-buy); background: color-mix(in srgb, var(--mha-buy) 14%, transparent); }
.mha-fill.is-sell .mha-fill-side { color: var(--mha-sell); background: color-mix(in srgb, var(--mha-sell) 14%, transparent); }
.mha-fill-time { font-size: 13px; color: var(--mha-text-3); white-space: nowrap; }
.mha-fill-nm { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--mha-text); text-align: left; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mha-fill-nm:hover { text-decoration: underline; }
.mha-fill-px { font-size: 13px; color: var(--mha-text-2); white-space: nowrap; text-align: right; }
.mha-fill-amt { white-space: nowrap; text-align: right; }
.mha-fill-pl { font-weight: 700; white-space: nowrap; text-align: right; }

/* ─── 2026-11-03 2차 — 회색을 줄이고 또렷하게: 남색 바탕 · 밝은 글자 · 카드마다 포인트 색 · 등장 애니메이션 ─── */
.mh { --mha-a1: #6a58e8; --mha-a2: #0e9f8a; --mha-a3: #b87900; }
:root:not([data-theme="light"]) .mh {
    /* 검정 테마는 진짜 검정 — 남색 기운을 빼고, 탁한 회색 대신 밝은 글자와 금색 포인트로 또렷하게 */
    --mh-bg: #0b0b0c;
    --mh-card: #151516;
    --mh-head: #1e1e20;
    --mh-hover: #232325;
    --mh-line: rgba(255, 255, 255, .09);
    --mh-text: #f5f5f4;
    --mh-text-2: #d4d4d2;
    --mh-text-3: #a8a8a5;
    --mha-buy: #ff6f6f;
    --mha-sell: #5ea6ff;
    --mha-a1: #f2b84b;
    --mha-a2: #3fc5b0;
    --mha-a3: #c9a6ff;
}
:root:not([data-theme="light"]) .mh-box { border-color: rgba(255, 255, 255, .14); }
:root:not([data-theme="light"]) .mh-periods .mh-period.is-on { background: #f5f5f4; color: #0b0b0c; }
:root:not([data-theme="light"]) .mh-psum { background: var(--mh-card); }
:root[data-theme="light"] .mha { --mha-text-3: #5c6a80; --mha-text-2: #3c4859; background: #f3f6fc; }
:root[data-theme="light"] .mha-card, :root[data-theme="light"] .mha-kpi { box-shadow: 0 2px 10px rgba(45, 70, 120, .07); border-color: rgba(70, 95, 150, .13); }

.mh-tab.is-on { box-shadow: inset 0 -2px 0 var(--mha-a1); }

.mha-insight { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; margin: 6px 0 12px; padding: 11px 15px; border-radius: 12px; background: linear-gradient(100deg, color-mix(in srgb, var(--mha-a1) 20%, transparent), color-mix(in srgb, var(--mha-a2) 12%, transparent)); color: var(--mha-text); }
.mha-ins-item { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.mha-kpi { position: relative; overflow: hidden; background: linear-gradient(145deg, color-mix(in srgb, var(--mha-tone, var(--mha-a1)) 17%, var(--mha-card)), var(--mha-card) 72%); border-color: color-mix(in srgb, var(--mha-tone, var(--mha-a1)) 32%, var(--mha-line)); transition: transform .18s ease, box-shadow .18s ease; }
.mha-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 22px color-mix(in srgb, var(--mha-tone, var(--mha-a1)) 22%, transparent); }
.mha-kpi.is-up { --mha-tone: var(--mha-buy); }
.mha-kpi.is-dn { --mha-tone: var(--mha-sell); }
.mha-kpi.is-a1 { --mha-tone: var(--mha-a1); }
.mha-kpi.is-a2 { --mha-tone: var(--mha-a2); }
.mha-kpi-s, .mha-kpi-l { color: var(--mha-text-2); }

.mha-card { background: linear-gradient(180deg, color-mix(in srgb, var(--mha-acc, var(--mha-a1)) 6%, var(--mha-card)), var(--mha-card) 90px); }
.mha-h { display: flex; align-items: center; gap: 8px; }
.mha-h::before { content: ""; flex: none; width: 4px; height: 15px; border-radius: 2px; background: var(--mha-acc, var(--mha-a1)); }
.mha-h-row .mha-h { min-width: 0; }

.mha-ax { fill: var(--mha-text-2); }
.mha-note, .mha-fill-time, .mha-asset-sub, .mha-asset-top span, .mha-cal-w { color: var(--mha-text-2); }
.mha-close { stroke: var(--mha-a1); opacity: .75; animation: mhaFade .5s ease both; }
.mha-k.is-line::before { background: var(--mha-a1); }
.mha-meter i { background: var(--mha-a1); }
.mha-asset.is-a2 .mha-meter i { background: var(--mha-a2); }
.mha-asset.is-a3 .mha-meter i { background: var(--mha-a3); }

/* 달력 — 거래한 날만 또렷하게 */
.mha-day { transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
.mha-day.is-none { opacity: .6; }
.mha-day i { color: inherit; }
button.mha-day.is-flat { background: color-mix(in srgb, var(--mha-a1) 16%, transparent); }
.mha-day-dot { background: var(--mha-a1); }
button.mha-day:hover { transform: translateY(-1px) scale(1.05); box-shadow: 0 5px 14px rgba(0, 0, 0, .22); border-color: transparent; z-index: 1; }
button.mha-day.is-sel { border-color: var(--mha-a1); box-shadow: 0 0 0 2px var(--mha-a1); }

/* 그 자리에 뜨는 날짜 팝업 */
.mha-pop { position: absolute; z-index: 6; width: min(380px, calc(100% - 16px)); border: 1px solid color-mix(in srgb, var(--mha-a1) 40%, var(--mha-line)); border-radius: 13px; background: var(--mha-card); box-shadow: 0 16px 40px rgba(5, 12, 30, .4); overflow: hidden; }
.mha-pop[hidden] { display: none; }
.mha-pop.is-open { animation: mhaPopIn .2s cubic-bezier(.2, .9, .3, 1.1) both; transform-origin: top center; }
.mha-pop-head { display: flex; align-items: center; gap: 10px; padding: 11px 12px 10px 15px; border-bottom: 1px solid var(--mha-line); background: color-mix(in srgb, var(--mha-a1) 12%, transparent); }
.mha-pop-head > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mha-pop-head b { font-size: 15px; }
.mha-pop-head span { font-size: 13px; }
.mha-pop-head strong { margin-left: auto; font-size: 16px; white-space: nowrap; }
.mha-pop-x { flex: none; width: 28px; height: 28px; margin-left: auto; border: 0; border-radius: 7px; background: transparent; color: var(--mha-text-2); font-size: 13px; cursor: pointer; }
.mha-pop-head strong + .mha-pop-x { margin-left: 0; }
.mha-pop-x:hover { background: color-mix(in srgb, var(--mha-text-3) 22%, transparent); }
.mha-pop-list { max-height: 270px; margin: 0; padding: 4px 0; overflow-y: auto; list-style: none; }
.mha-pop-list li { display: flex; align-items: center; gap: 9px; padding: 8px 14px; border-left: 3px solid transparent; }
.mha-pop-list li.is-buy { border-left-color: var(--mha-buy); }
.mha-pop-list li.is-sell { border-left-color: var(--mha-sell); }
.mha-pop-main { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.mha-pop-main > span { font-size: 13px; color: var(--mha-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mha-pop-side { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex: none; font-size: 13px; font-weight: 700; white-space: nowrap; }
.mha-pop-side em { font-style: normal; font-weight: 800; }
.mha-pop-list .is-buy em { color: var(--mha-buy); }
.mha-pop-list .is-sell em { color: var(--mha-sell); }

/* 로고 */
.mha-logo { position: relative; flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; overflow: hidden; background: var(--mha-lg, var(--mha-a1)); color: #fff; }
.mha-logo i { font-style: normal; font-size: 13px; font-weight: 800; line-height: 1; }
.mha-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.mha-bar-nm { display: flex; align-items: center; gap: 7px; min-width: 0; }
.mha-bar-nm > span:last-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mha-pick { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.mha-fill-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mha-bar-row { transition: background .14s ease, transform .14s ease; }
button.mha-bar-row:hover { transform: translateX(2px); }
.mha-bar-row.is-sel { background: color-mix(in srgb, var(--mha-a1) 22%, transparent); }
.mha-fill { transition: background .14s ease; }
.mha-fill:hover { background: color-mix(in srgb, var(--mha-a1) 9%, transparent); }
.mha-credit { margin: 10px 2px 0; font-size: 13px; text-align: right; }
.mha-credit a { color: var(--mha-text-2); }

/* 등장 애니메이션 — 처음 열 때 한 번 */
@keyframes mhaRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes mhaFade { from { opacity: 0; } }
@keyframes mhaPopIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes mhaDraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes mhaGrowX { from { transform: scaleX(0); } }
@keyframes mhaGrowY { from { transform: scaleY(0); } }
@keyframes mhaMark { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: none; } }

.mha.is-intro .mha-insight { animation: mhaRise .4s ease both; }
.mha.is-intro .mha-kpi { animation: mhaRise .42s ease both; }
.mha.is-intro .mha-kpi:nth-child(2) { animation-delay: .05s; }
.mha.is-intro .mha-kpi:nth-child(3) { animation-delay: .1s; }
.mha.is-intro .mha-kpi:nth-child(4) { animation-delay: .15s; }
.mha.is-intro .mha-card { animation: mhaRise .45s ease both; animation-delay: .12s; }
.mha.is-intro .mha-card:nth-child(2) { animation-delay: .18s; }
.mha.is-intro .mha-card:nth-child(n+3) { animation-delay: .26s; }
.mha.is-intro .mha-flow-line { stroke-dasharray: 1; animation: mhaDraw 1.1s .25s ease-out both; }
.mha.is-intro .mha-flow-area { animation: mhaFade .7s .7s ease both; }
.mha.is-intro .mha-bar { animation: mhaGrowX .7s .32s cubic-bezier(.2, .8, .2, 1) both; }
.mha-bar.is-up { transform-origin: left center; }
.mha-bar.is-dn { transform-origin: right center; }
.mha.is-intro .mha-col { transform-box: fill-box; transform-origin: center bottom; animation: mhaGrowY .55s .4s cubic-bezier(.2, .8, .2, 1) both; }
.mha.is-intro .mha-meter i { transform-origin: left center; animation: mhaGrowX .7s .45s cubic-bezier(.2, .8, .2, 1) both; }
.mha-cal.is-in button.mha-day { animation: mhaPopIn .26s ease both; animation-delay: calc(var(--i, 0) * 12ms + .1s); }
.mha-plot.is-pop .mha-mark polygon, .mha-plot.is-pop .mha-vtx { transform-box: fill-box; transform-origin: center; animation: mhaMark .3s cubic-bezier(.2, 1.3, .4, 1) both; animation-delay: calc(var(--i, 0) * 22ms + .05s); }
.mha.is-intro .mha-fill { animation: mhaRise .32s ease both; animation-delay: calc(var(--i, 0) * 22ms + .3s); }

@media (prefers-reduced-motion: reduce) {
    .mha *, .mha-pop { animation: none !important; transition: none !important; }
}

/* 체결 내역 — 가격·금액 글자도 매수 빨강 · 매도 파랑 */
.mha-fill.is-buy .mha-fill-px, .mha-fill.is-buy .mha-fill-amt, .mha-pop-list .is-buy .mha-pop-main > span, .mha-pop-list .is-buy .mha-pop-side > span { color: var(--mha-buy); }
.mha-fill.is-sell .mha-fill-px, .mha-fill.is-sell .mha-fill-amt, .mha-pop-list .is-sell .mha-pop-main > span { color: var(--mha-sell); }
.mha-fill-amt { font-weight: 700; }

/* 계산 기준 — 머리글 오른쪽 작은 버튼 + 그 아래 팝업 */
.mh-head .mh-x { margin-left: 0; }
.mh-help-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 7px; border: 1px solid var(--mh-line, var(--mo-line)); border-radius: 15px; background: transparent; color: var(--mh-text-2, var(--mo-text-2)); font-size: 13px; cursor: pointer; transition: color .14s ease, border-color .14s ease, background .14s ease; }
.mh-help-btn i { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: color-mix(in srgb, var(--mha-a1) 22%, transparent); color: var(--mha-a1); font-style: normal; font-size: 13px; font-weight: 800; line-height: 1; }
.mh-help-btn:hover, .mh-help-btn.is-on { color: var(--mh-text, var(--mo-text)); border-color: var(--mha-a1); }
.mh-help-pop { position: absolute; top: 56px; right: 18px; z-index: 8; width: min(380px, calc(100% - 28px)); max-height: calc(100% - 72px); overflow-y: auto; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--mha-a1) 40%, var(--mh-line, var(--mo-line))); border-radius: 13px; background: var(--mh-card, var(--mo-surface)); color: var(--mh-text-2, var(--mo-text-2)); box-shadow: 0 16px 40px rgba(0, 0, 0, .35); animation: mhaPopIn .18s ease both; transform-origin: top right; }
.mh-help-pop[hidden] { display: none; }
.mh-help-title { margin-bottom: 8px; font-size: 14px; font-weight: 700; color: var(--mh-text, var(--mo-text)); }
.mh-help-pop ul.mh-note { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.mh-help-pop ul.mh-note[hidden] { display: none; }
.mh-help-pop li { font-size: 13px; line-height: 1.55; }
.mh-help-pop li b { display: block; font-weight: 700; color: var(--mh-text, var(--mo-text)); }
.mh-table-wrap { margin-bottom: 16px; }

/* 종목별 손익 — 안내 문구는 카드 맨 아래에 고정 */
.mha-card--col { display: flex; flex-direction: column; }
.mha-col-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.mha-note--foot { margin-top: auto; padding-top: 12px; }
/* 체결 시점 · 팝업 자리 (2026-11-03) */
.mha-plot-wait { height: 230px; }
.mha-mark polygon { stroke-width: 1.5; }
.mha-pop.is-open { transform-origin: right top; }
.mha-pop.is-sheet.is-open { transform-origin: center bottom; }

/* 요약 카드 — 누르면 내역 팝업 (2026-11-03) */
button.mha-kpi { width: 100%; font: inherit; color: var(--mha-text); text-align: left; cursor: pointer; }
.mha-kpi::after { content: "›"; position: absolute; top: 10px; right: 13px; font-size: 18px; line-height: 1; color: var(--mha-text-2); transition: transform .16s ease; }
.mha-kpi:hover::after { transform: translateX(2px); }
.mha-kpi.is-sel::after { transform: rotate(90deg); }
.mha-kpi.is-sel { border-color: var(--mha-tone, var(--mha-a1)); box-shadow: 0 0 0 1px var(--mha-tone, var(--mha-a1)); }
.mha-kpi:focus-visible { outline: 2px solid var(--mha-a1); outline-offset: 2px; }
.mha-kv-wrap { display: flex; flex-direction: column; gap: 9px; padding: 13px 15px; }
.mha-kv { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; font-size: 14px; }
.mha-kv > span { flex: none; font-size: 13px; color: var(--mha-text-2); }
.mha-kv > b { min-width: 0; font-weight: 700; text-align: right; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mha-kv-go { display: block; width: 100%; padding: 11px 15px; border: 0; border-top: 1px solid var(--mha-line); background: transparent; font: inherit; font-size: 13px; font-weight: 700; color: var(--mha-a1); text-align: right; cursor: pointer; }
.mha-kv-go:hover { background: color-mix(in srgb, var(--mha-a1) 10%, transparent); }
.mha-winbar { display: flex; gap: 2px; height: 10px; margin-bottom: 3px; overflow: hidden; border-radius: 5px; }
.mha-winbar i { display: block; min-width: 0; }
.mha-winbar .is-up { background: var(--mha-buy); }
.mha-winbar .is-dn { background: var(--mha-sell); }

/* 주문내역 · 수익분석 표 — 가격·금액 글자도 매수 빨강 · 매도 파랑 (수량은 그대로) */
.mh .mh-table tbody tr.mh-row.is-buy td.mh-px, .mh .mh-table td.mh-c-buy { color: var(--mha-buy); }
.mh .mh-table tbody tr.mh-row.is-sell td.mh-px, .mh .mh-table td.mh-c-sell { color: var(--mha-sell); }
.mh .mh-psum-sub > span b.mh-c-buy { color: var(--mha-buy); }
.mh .mh-psum-sub > span b.mh-c-sell { color: var(--mha-sell); }
/* 합계 줄 칸 여백을 위 줄과 같게 — 숫자 끝이 어긋나지 않게 */
.mh-ptable tfoot td { padding-left: 14px; padding-right: 14px; }

/* 체결 표시 — 꼭짓점 점 + 끝이 닿는 삼각형 */
.mha-close { opacity: 1; }
.mha-vtx { stroke: var(--mha-card); stroke-width: 1.5; paint-order: stroke; }
.mha-vtx.is-buy { fill: var(--mha-buy); }
.mha-vtx.is-sell { fill: var(--mha-sell); }
.mha-vtx.is-both { fill: var(--mha-text); }
.mha-mark polygon { stroke: none; }
.mha-tip em { font-style: normal; font-weight: 700; }

/* 주문내역 표 — 줄 왼쪽 색 띠와 또렷한 알약으로 매수·매도를 바로 구분 */
.mh-table tbody tr.mh-row.is-buy td:first-child { box-shadow: inset 3px 0 0 var(--mha-buy); }
.mh-table tbody tr.mh-row.is-sell td:first-child { box-shadow: inset 3px 0 0 var(--mha-sell); }
.mh-table tbody tr.mh-row.is-muted.is-buy td:first-child,
.mh-table tbody tr.mh-row.is-muted.is-sell td:first-child { box-shadow: inset 3px 0 0 var(--mh-line, var(--mo-line)); }
.mh-side.is-buy { color: var(--mha-buy); background: color-mix(in srgb, var(--mha-buy) 16%, transparent); }
.mh-side.is-sell { color: var(--mha-sell); background: color-mix(in srgb, var(--mha-sell) 16%, transparent); }
.mh-side { white-space: nowrap; }

/* 높이가 낮은 창에서 탭 아래 표 영역과 같은 자리 차지 */
.mh-table-wrap[hidden] { display: none; }

@media (max-width: 480px) {
    .mh-help-btn { padding: 0 5px; }
    .mh-help-btn span { display: none; }
}
@media (max-width: 860px) {
    .mha { padding: 4px 12px 14px; }
    .mha-grid { grid-template-columns: minmax(0, 1fr); }
    .mha-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mha-kpi-v { font-size: 20px; }
    .mha-fill { grid-template-columns: 66px minmax(0, 1fr) auto; gap: 4px 8px; padding: 7px 8px; }
    .mha-fill-time { grid-column: 2 / 4; grid-row: 2; }
    .mha-fill-px { grid-column: 1 / 3; grid-row: 3; text-align: left; }
    .mha-fill-amt { grid-column: 3; grid-row: 3; }
    .mha-fill-who { grid-column: 2; grid-row: 1; }
    .mha-fill-pl { grid-column: 3; grid-row: 1; }
}

/* 필터 줄도 창과 같은 남색 — 회색 띠가 남지 않게 */
:root:not([data-theme="light"]) .mh-filters,
:root:not([data-theme="light"]) .mh-summary { background: var(--mh-bg); }

/* 주문 패널 '거래내역' 버튼 — 눌러 볼 만한 분석 화면 입구답게: 금색 포인트 · 그래프 아이콘 · 움직임 (2026-11-03) */
#moHistoryOpen {
    --mo-hb: #b87900;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px 0 10px;
    border: 1px solid color-mix(in srgb, var(--mo-hb) 55%, transparent);
    border-radius: 10px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--mo-hb) 18%, transparent), color-mix(in srgb, var(--mo-hb) 5%, transparent));
    color: var(--mo-hb);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -.2px;
    white-space: nowrap;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}
:root:not([data-theme="light"]) #moHistoryOpen { --mo-hb: #f2b84b; }
#moHistoryOpen::before {
    content: "";
    flex: none;
    width: 16px;
    height: 16px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19h16'/%3E%3Cpath d='M5 14l5-5 4 3 6-7'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19h16'/%3E%3Cpath d='M5 14l5-5 4 3 6-7'/%3E%3C/svg%3E") center / contain no-repeat;
}
#moHistoryOpen:hover {
    transform: translateY(-1px);
    border-color: var(--mo-hb);
    background: linear-gradient(135deg, color-mix(in srgb, var(--mo-hb) 30%, transparent), color-mix(in srgb, var(--mo-hb) 10%, transparent));
    box-shadow: 0 5px 14px color-mix(in srgb, var(--mo-hb) 26%, transparent);
}
#moHistoryOpen:active { transform: translateY(0); box-shadow: none; }
#moHistoryOpen:focus-visible { outline: 2px solid var(--mo-hb); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { #moHistoryOpen { transition: none; } }

/* 종목 선택 — 묶음 이름(국내 주식 등)은 색으로 종목과 구분 · 종목 글자는 그대로 */
.mh .mh-filters select optgroup { font-style: normal; font-weight: 800; }
.mh .mh-filters select optgroup.mh-og-cur { color: var(--mha-buy); }
.mh .mh-filters select optgroup.mh-og-1 { color: var(--mha-a1); }
.mh .mh-filters select optgroup.mh-og-2 { color: var(--mha-a2); }
.mh .mh-filters select optgroup.mh-og-3 { color: var(--mha-a3); }
.mh .mh-filters select optgroup option { font-weight: 600; color: var(--mh-text, var(--mo-text)); }
