/* 인포맥스식 레트로 라이트: 윈도우 클래식 크롬, 12px 고딕(맥 SD Gothic Neo / 윈도우 맑은고딕·굴림), 격자선, 직각, 원색 */
:root {
  --desk: #c9d3df;
  --face: #ece9d8;
  --face-2: #f4f2ea;
  --frame: #7f7f7f;
  --frame-light: #ffffff;
  --frame-dark: #404040;
  --title-a: #0a246a;
  --title-b: #3a6ea5;
  --title-c: #a6caf0;
  --head: #dde6f2;
  --grid: #b4b4b4;
  --text: #000000;
  --dim: #5a5a5a;
  --up: #e00000;
  --down: #0000d0;
  --select: #ffffc8;
  --ok: #00a000;
  --wait: #e0a000;
  --off: #a0a0a0;
  --font: "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", "Gulim", "굴림", "Dotum", "돋움", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--desk);
  color: var(--text);
  font: 12px/1.3 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum";
  display: flex; flex-direction: column;
}
.desk { flex: 1; padding: 4px; display: flex; flex-direction: column; gap: 0; min-height: 0; }
.row { display: flex; gap: 0; flex: 1; min-height: 120px; }
.row.top { flex: none; }
.row.top > #win-2000 { flex: 1 1 0; min-width: 480px; }
.win.chart { flex: 0 0 38%; min-width: 300px; display: flex; flex-direction: column; }
.win.chart .ch-body { flex: 1; min-height: 160px; background: #fff; position: relative; border-top: 1px solid var(--frame-light); }
.win.chart canvas { display: block; position: absolute; inset: 0; }
.ch-title { padding: 2px 6px; background: #fff; border-top: 1px solid var(--frame); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-title b { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", var(--font); font-variant-numeric: tabular-nums; }
.toolbar.chartbar { gap: 2px; }
.tabbtn.sq { height: 18px; padding: 0 7px; margin: 0; border-color: var(--frame-light) var(--frame-dark) var(--frame-dark) var(--frame-light); }
.tabbtn.sq.on { background: #fff; border-color: var(--frame-dark) var(--frame-light) var(--frame-light) var(--frame-dark); }
.tabbtn i.lg { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 3px; }
.tabbtn i.ma20 { background: #c07800; } .tabbtn i.ma60 { background: #7b3fa0; }
.tabbtn.sq[data-ma]:not(.on) i.lg { opacity: .3; }
.tb-native { font: inherit; height: 18px; background: #fff; border: 1px solid; border-color: var(--frame) var(--frame-light) var(--frame-light) var(--frame); padding: 0 2px; color: #000; }
.tb-native:disabled { color: var(--off); }
.ch-title .legend { margin-left: 10px; color: var(--dim); }
.ch-title i.lg { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin: 0 3px 0 6px; }
.ch-title i.lg.dash { background-image: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); }
/* 분할선: 인포맥스처럼 얇은 홈. 드래그로 크기 조절 */
.splitter { flex: none; background: var(--desk); position: relative; z-index: 2; }
.splitter.h { height: 5px; cursor: row-resize; }
.splitter.v { width: 5px; cursor: col-resize; }
.splitter::after { content: ""; position: absolute; background: var(--frame); opacity: .55; }
.splitter.h::after { left: 50%; top: 2px; width: 40px; height: 1px; margin-left: -20px; box-shadow: 0 1px 0 var(--frame-light); }
.splitter.v::after { top: 50%; left: 2px; height: 40px; width: 1px; margin-top: -20px; box-shadow: 1px 0 0 var(--frame-light); }
.splitter:hover, .splitter.active { background: #b7c4d6; }
body.resizing { cursor: inherit; user-select: none; }
body.resizing iframe, body.resizing table { pointer-events: none; }
.win.sub { flex: 1; min-height: 0; }
.win.sub .grid-wrap { border-bottom: none; }
.win.news { flex: 1 1 0; min-width: 240px; }
#win-2200 { flex: 1 1 0; min-width: 260px; }
#stable-summary { white-space: nowrap; overflow: hidden; }
#stable-summary .tb-label { flex: none; } #stable-summary b { margin-right: 6px; }
#win-2000.sized { flex: none; }
#row-top.sized { flex: none; }
.win.sub.news .grid-wrap { border-bottom: 1px solid var(--frame); }
#win-2200 .grid-wrap { flex: none; overflow: visible; }
/* 상태판: 그리드 2개를 위아래로 쌓아 가로를 전부 쓴다. 글자가 잘리지 않게 값·항목명 폰트 키움(Leo 26-09-23) */
.kpi-row { flex: 1; display: flex; flex-direction: column; gap: 0; min-height: 0; overflow: auto; background: #fff; border-top: 1px solid var(--frame); }
.kpi-row table { width: 100%; table-layout: fixed; }
.kpi-row table + table { border-top: 2px solid var(--frame); }
.grid.kpi thead th { text-align: left; color: var(--title-a); font-weight: bold; background: var(--head); font-size: 12px; height: 22px; }
.grid.kpi td { padding: 2px 8px; height: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid.kpi td.k { text-align: left; color: var(--dim); width: 38%; font-size: 12px; }
.grid.kpi td.v { text-align: right; font-weight: bold; width: 30%; font-size: 14.5px; letter-spacing: -0.2px; }
.grid.kpi td.c { text-align: right; width: 32%; font-size: 12.5px; }
.grid.kpi td.sub { color: var(--dim); font-weight: normal; }
#news { table-layout: fixed; }
#news th.c-time, #news td.c-time { width: 54px; text-align: center; color: var(--dim); }
#news th.c-src, #news td.c-src { width: 84px; text-align: left; color: var(--dim); }
#news td.c-title { text-align: left; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
#news td.c-time:has(+ td) { padding: 1px 3px; }
#news tbody tr:hover td { background: var(--select); }

/* 매크로 스트립: 인포맥스 상단 지표줄 */
.strip {
  flex: none; display: flex; align-items: center; gap: 8px; height: 24px; margin-bottom: 4px; padding: 0 6px;
  background: var(--face); border: 1px solid var(--frame-dark);
  box-shadow: inset 1px 1px 0 var(--frame-light), inset -1px -1px 0 var(--frame);
  overflow: hidden; white-space: nowrap;
}
.strip-title { color: var(--title-a); font-weight: bold; flex: none; }
.strip-items { flex: 1; overflow: hidden; position: relative; height: 100%; display: flex; align-items: center; }
/* 항목이 넘치면 티커처럼 왼쪽으로 흐른다(단말기 티커 테이프). 마우스를 올리면 정지 */
.strip-track { display: inline-flex; white-space: nowrap; will-change: transform; }
.strip-track.marquee { animation: ticker var(--ticker-dur, 60s) linear infinite; }
.strip-items:hover .strip-track.marquee { animation-play-state: paused; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.strip-item { display: inline-flex; align-items: baseline; gap: 5px; padding: 0 10px; border-left: 1px solid var(--frame); }
.strip-track:not(.marquee) .strip-item:first-child { border-left: none; padding-left: 0; }
.strip-item .l { color: var(--dim); }
.strip-item .v { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", var(--font); font-variant-numeric: tabular-nums; font-weight: bold; }
.strip-item .c { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", var(--font); font-variant-numeric: tabular-nums; }
.strip-item.dim { color: var(--dim); }
.strip-time { flex: none; color: var(--dim); }
.toolbar.slim { padding: 2px 5px; gap: 10px; }
.toolbar.tabs { gap: 2px; padding: 3px 4px 0; border-bottom: 1px solid var(--frame); background: var(--face); }
.tabbtn {
  font: inherit; height: 20px; padding: 0 10px; cursor: pointer; color: var(--dim);
  background: var(--face); border: 1px solid; border-color: var(--frame-light) var(--frame-dark) var(--frame) var(--frame-light);
  border-bottom-color: var(--frame); margin-bottom: -1px;
}
.tabbtn.on { color: #000; font-weight: bold; background: #fff; border-bottom-color: #fff; }
.toolbar.tabs .tb-note { margin-left: auto; padding-bottom: 3px; }
.toolbar.korea { border-top: 1px solid var(--frame-light); white-space: nowrap; overflow: hidden; }
.toolbar.korea .tb-label { color: var(--title-a); }
.toolbar.slim b { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", var(--font); font-variant-numeric: tabular-nums; }

/* 윈도우 */
.win {
  flex: none; display: flex; flex-direction: column; min-height: 0; max-height: 100%;
  background: var(--face);
  border: 1px solid var(--frame-dark);
  box-shadow: inset 1px 1px 0 var(--frame-light), inset -1px -1px 0 var(--frame);
}
.titlebar {
  height: 22px; display: flex; align-items: center; gap: 6px; padding: 0 3px 0 4px;
  background: linear-gradient(90deg, var(--title-a), var(--title-b) 55%, var(--title-c));
  color: #fff; font-weight: bold; letter-spacing: 0;
}
.t-icon { width: 14px; height: 14px; background: #fff; color: var(--title-a); font-size: 10px; font-weight: bold; text-align: center; line-height: 14px; }
.t-text { flex: 1; text-shadow: 1px 1px 0 rgba(0,0,0,.45); }
.t-btns { display: flex; gap: 2px; }
.t-btns b {
  width: 16px; height: 14px; display: inline-block; text-align: center; line-height: 12px; font-size: 11px;
  background: var(--face); color: #000;
  border: 1px solid; border-color: var(--frame-light) var(--frame-dark) var(--frame-dark) var(--frame-light);
}
.toolbar {
  display: flex; align-items: center; gap: 4px; padding: 3px 4px; border-bottom: 1px solid var(--frame);
  background: var(--face); white-space: nowrap; overflow: hidden; flex: none;
}
.toolbar .tb-select, .toolbar .tb-field, .toolbar .tabbtn { flex: none; }
.tb-label { color: var(--dim); margin-left: 2px; }
.tb-select, .tb-field {
  background: #fff; border: 1px solid; border-color: var(--frame) var(--frame-light) var(--frame-light) var(--frame);
  padding: 1px 5px; height: 20px; line-height: 16px; display: inline-flex; align-items: center; gap: 6px;
}
.tb-select i { font-style: normal; font-size: 8px; color: #000; background: var(--face); border: 1px solid var(--frame); padding: 0 2px; line-height: 10px; }
.tb-field b { font-weight: bold; }
.tb-note { color: var(--dim); }
.tb-sep { width: 1px; height: 16px; background: var(--frame); margin: 0 4px; box-shadow: 1px 0 0 var(--frame-light); }
.tb-right { margin-left: auto; display: flex; gap: 8px; }
.conn { display: inline-flex; align-items: center; gap: 4px; color: var(--dim); }
.conn i { width: 8px; height: 8px; display: inline-block; background: var(--off); border: 1px solid var(--frame-dark); }
.conn.on { color: var(--text); } .conn.on i { background: var(--ok); }
.conn.wait i { background: var(--wait); }

/* 표: 격자선 전부, 직각, 밀도 높게 */
.grid-wrap { flex: 1; overflow: auto; background: #fff; border-top: 1px solid var(--frame-light); }
table.grid { border-collapse: collapse; width: 100%; table-layout: fixed; }
#quotes { min-width: 980px; }
#stables { min-width: 420px; }
#news { min-width: 360px; }
/* 숫자 폭 고정: SD Gothic Neo는 숫자 폭이 제각각이라 시스템 서체(SF/Segoe)의 tabular 숫자로 그린다. 한글은 자동 폴백 */
.grid td, .grid th, .tb-field, .tray, .tb-note {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", var(--font);
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}
/* 열 폭은 비율로 고정(합 100%) → 창 크기에 따라 함께 늘고 내용 변화에는 흔들리지 않음 */
#quotes col.w-rank { width: 4%; } #quotes col.w-sym { width: 6.5%; } #quotes col.w-name { width: 9.5%; }
#quotes col.w-krw { width: 11%; } #quotes col.w-usd { width: 10%; } #quotes col.w-pct { width: 8%; } #quotes col.w-val { width: 9.5%; }
#stables col.w-sym { width: 13%; } #stables col.w-krw { width: 15%; } #stables col.w-pct { width: 14%; } #stables col.w-usd { width: 15%; } #stables col.w-val { width: 14.5%; }
.grid td { overflow: hidden; text-overflow: ellipsis; }
.grid th, .grid td {
  border: 1px solid var(--grid); padding: 1px 6px; height: 21px; white-space: nowrap;
}
.grid thead th {
  position: sticky; top: 0; background: var(--head); font-weight: normal; color: #000; text-align: center;
  border-bottom: 1px solid var(--frame); z-index: 1;
}
.grid td { text-align: right; }
.grid td.c-rank { text-align: center; color: var(--dim); }
.grid td.c-sym { text-align: left; font-weight: bold; }
.grid td.c-name { text-align: left; color: #000; }
.grid td.empty { color: var(--off); text-align: center; }
.grid tbody tr.sel td { background: var(--select); }
.up { color: var(--up); } .down { color: var(--down); }
.grid td.mark-up { background: var(--up); color: #fff; }
.grid td.mark-down { background: var(--down); color: #fff; }
/* 틱 플래시: 셀 배경 채움은 산만해 반려(26-09-23) → 1px 안쪽 보더만 잠깐 그린다. 즉시 켜지고 즉시 꺼짐 */
.grid td.flash-up { box-shadow: inset 0 0 0 1px var(--up); }
.grid td.flash-down { box-shadow: inset 0 0 0 1px var(--down); }
.placeholder td { text-align: center !important; color: var(--dim); height: 60px; }
.win-foot {
  display: flex; justify-content: space-between; gap: 12px; padding: 2px 5px;
  color: var(--dim); border-top: 1px solid var(--frame); background: var(--face);
}

/* 하단 탭바 */
.taskbar {
  height: 26px; display: flex; align-items: center; gap: 2px; padding: 0 4px;
  background: var(--face); border-top: 1px solid var(--frame-light);
}
.tab {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px 0 4px;
  border: 1px solid; border-color: var(--frame-light) var(--frame-dark) var(--frame-dark) var(--frame-light);
  background: var(--face);
}
.tab.on { background: var(--face-2); border-color: var(--frame-dark) var(--frame-light) var(--frame-light) var(--frame-dark); font-weight: bold; }
.tab.dim { color: var(--dim); }
.tab i { font-style: normal; width: 12px; height: 12px; background: var(--title-a); color: #fff; font-size: 9px; text-align: center; line-height: 12px; font-weight: bold; }
.tab.dim i { background: #8a94a6; }
.tray { margin-left: auto; padding: 0 6px; height: 20px; line-height: 18px; border: 1px solid; border-color: var(--frame) var(--frame-light) var(--frame-light) var(--frame); }
