@font-face {
  font-family: "Pretendard";
  src: url("/static/PretendardVariable.woff2") format("woff2-variations");
  font-weight: 45 920;
  font-display: swap;
}

:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --sunken: #f6f8fa;
  --ink: #16202a;
  --ink-2: #3a4652;
  --muted: #66727f;
  --line: #d9dfe5;
  --line-soft: #e8ecf0;
  --brand: #0d6b66;
  --brand-soft: #dcefed;
  --up: #d22f3c;
  --up-soft: #fbe5e7;
  --down: #1f5bd6;
  --down-soft: #e2eafb;
  --warn: #a8641a;
  --warn-soft: #f7ead9;
  --r-lg: 10px;
  --r-sm: 6px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 17px;
  --fs-xl: 22px;
  --fs-2xl: 32px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: var(--fs-md);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
textarea { line-height: 1.5; resize: vertical; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- 틀 */
.shell { display: grid; grid-template-columns: 196px minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 2px;
  padding: 22px 14px; background: var(--ink); color: #c9d2db;
}
.rail a { text-decoration: none; padding: 8px 12px; border-radius: var(--r-sm); font-weight: 500; }
.rail a:hover { background: rgba(255,255,255,.06); color: #fff; }
.rail a.on { background: var(--brand); color: #fff; }
.rail .brand { color: #fff; font-weight: 750; font-size: var(--fs-lg); padding: 0 12px 18px; letter-spacing: -0.01em; }
.rail .brand:hover { background: none; }
.jump { margin-top: auto; padding: 0 4px; }
.jump label { display: block; font-size: var(--fs-xs); color: #8c98a5; margin: 0 0 6px 4px; }
.jump input {
  width: 100%; padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid #33404d; background: #1f2b37; color: #fff;
}

main { padding: 28px 32px 64px; max-width: 1360px; width: 100%; }
main:focus { outline: none; }

/* ---------- 머리글 */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head h1, .head .h1 { margin: 0; font-size: var(--fs-xl); font-weight: 750; letter-spacing: -0.02em; }
.head .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }

/* ---------- 면 */
.grid { display: grid; gap: 16px; }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; min-width: 0; }
.panel h2 { margin: 0 0 12px; font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.01em; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.panel h2 small { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.panel h2 a { font-size: var(--fs-sm); color: var(--brand); font-weight: 600; text-decoration: none; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush h2 { padding: 18px 20px 0; }

.empty { color: var(--muted); padding: 24px 0; text-align: center; }

/* ---------- 숫자 색 */
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }
.num { text-align: right; white-space: nowrap; }

/* ---------- 칩 */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600;
  background: var(--sunken); color: var(--ink-2); border: 1px solid var(--line-soft); white-space: nowrap; text-decoration: none;
}
a.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.buy { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip.watch { background: var(--sunken); }
.chip.avoid { background: var(--ink-2); color: #fff; border-color: var(--ink-2); }
.chip.tp { background: var(--up-soft); color: var(--up); border-color: transparent; }
.chip.sl { background: var(--down-soft); color: var(--down); border-color: transparent; }
.chip.run { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip.exp { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.g-A { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip.g-C { color: var(--muted); }
.chip.imp { background: var(--up-soft); color: var(--up); border-color: transparent; }
.chip.conv-hi { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.conv-mid { background: var(--surface); color: var(--ink); border-color: var(--ink-2); }
.insight { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 8px 0 0; padding: 8px 10px; background: var(--sunken); border-left: 3px solid var(--brand); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: var(--fs-xs); white-space: normal; }
.insight dt { color: var(--muted); font-weight: 600; }
.insight dd { margin: 0; color: var(--ink-2); }
.conv-tbl { margin-top: 4px; }
.conv-tbl th, .conv-tbl td { padding: 7px 6px; }
.notes { font-size: var(--fs-xs); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- 추천 진행 막대: 손절 ─ 기준 ─ 목표 사이 현재가 위치 */
.reclist { display: flex; flex-direction: column; }
.rec {
  display: grid; grid-template-columns: minmax(130px, 1.1fr) minmax(220px, 3fr) 92px; gap: 18px; align-items: center;
  padding: 14px 0; border-top: 1px solid var(--line-soft);
}
.rec:first-child { border-top: 0; padding-top: 4px; }
.rec .who a { font-weight: 700; text-decoration: none; font-size: var(--fs-md); }
.rec .who a:hover { color: var(--brand); }
.rec .who .meta { color: var(--muted); font-size: var(--fs-xs); margin-top: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rec .res { text-align: right; }
.rec .res .pct { font-size: var(--fs-lg); font-weight: 750; }
.rec .res .days { font-size: var(--fs-xs); color: var(--muted); }

.track { position: relative; height: 44px; }
.track .bar { position: absolute; left: 0; right: 0; top: 17px; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--down-soft), var(--sunken) 40%, var(--sunken) 60%, var(--up-soft)); }
.track .zone { position: absolute; top: 15px; height: 10px; border-radius: 3px; background: rgba(13,107,102,.22); }
.track .tick { position: absolute; top: 12px; width: 2px; height: 16px; margin-left: -1px; border-radius: 1px; }
.track .tick.stop { background: var(--down); }
.track .tick.target { background: var(--up); }
.track .tick.ref { background: var(--ink-2); height: 12px; top: 14px; }
.track .lab { position: absolute; top: 30px; font-size: 11px; color: var(--muted); transform: translateX(-50%); white-space: nowrap; }
.track .lab.l { transform: none; }
.track .lab.r { transform: translateX(-100%); }
.track .lab.stop { color: var(--down); }
.track .lab.target { color: var(--up); }
.track .now { position: absolute; top: 12px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--ink); box-shadow: 0 0 0 3px var(--surface); }
.track .now.up { border-color: var(--up); }
.track .now.down { border-color: var(--down); }
.track .nowlab { position: absolute; top: -4px; font-size: 11px; font-weight: 700; transform: translateX(-50%); white-space: nowrap; }
.track.plain { height: auto; color: var(--muted); font-size: var(--fs-sm); }

/* ---------- 성적 숫자 */
.score { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 12px; }
.score div { border-left: 3px solid var(--line); padding-left: 10px; }
.score b { display: block; font-size: var(--fs-xl); font-weight: 750; letter-spacing: -0.02em; line-height: 1.2; }
.score span { font-size: var(--fs-xs); color: var(--muted); }
.score .k-tp { border-color: var(--up); }
.score .k-sl { border-color: var(--down); }
.score .k-run { border-color: var(--brand); }

/* ---------- 테마 흐름 (0 기준 좌우 막대) */
.flow { display: flex; flex-direction: column; gap: 3px; }
.flow a { display: grid; grid-template-columns: 132px 1fr 56px; gap: 10px; align-items: center; text-decoration: none; padding: 3px 4px; border-radius: 4px; font-size: var(--fs-sm); }
.flow a:hover { background: var(--sunken); }
.flow .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow .axis { position: relative; height: 10px; }
.flow .axis::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line); }
.flow .b { position: absolute; top: 1px; height: 8px; border-radius: 2px; }
.flow .b.up { background: var(--up); left: 50%; }
.flow .b.down { background: var(--down); right: 50%; }

/* ---------- 작은 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--line-soft); font-size: var(--fs-sm); }
.list li:first-child { border-top: 0; }
.list.scroll { max-height: 520px; overflow-y: auto; padding-right: 6px; }
.list .when { color: var(--muted); width: 74px; flex: none; font-size: var(--fs-xs); }
.list .what { flex: 1; min-width: 0; }
.list .what a { text-decoration: none; }
.list .what a:hover { text-decoration: underline; }
.list .side { flex: none; }
.list .src { color: var(--muted); font-size: var(--fs-xs); margin-left: 6px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: var(--fs-sm); margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }

.breadth { display: flex; flex-direction: column; gap: 10px; }
.breadth .row { display: grid; grid-template-columns: 1fr auto; gap: 4px; font-size: var(--fs-sm); }
.breadth .meter { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--down-soft); overflow: hidden; }
.breadth .meter i { display: block; height: 100%; background: var(--up); }

/* ---------- 표 */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); min-width: 0; }
.toolbar input[type=search] { width: 220px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: #fff; }
.toolbar .count { color: var(--muted); font-size: var(--fs-sm); margin-left: auto; }

.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tbl th { position: sticky; top: 0; background: var(--sunken); color: var(--muted); font-weight: 600; text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl th[data-sort] { cursor: pointer; user-select: none; }
.tbl th[data-sort]:hover { color: var(--ink); }
.tbl th.sorted { color: var(--ink); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; }
.tbl tr:hover td { background: #fafbfc; }
.tbl td a.name { font-weight: 650; text-decoration: none; }
.tbl td a.name:hover { color: var(--brand); }
.tbl td .code { color: var(--muted); font-size: var(--fs-xs); margin-left: 4px; }
.tbl td.wrap { white-space: normal; min-width: 340px; }
.more { display: block; margin: 14px auto 0; padding: 8px 18px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); cursor: pointer; font-weight: 600; }
.more:hover { border-color: var(--brand); color: var(--brand); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.ok { background: var(--brand); }
.dot.bad { background: var(--warn); }

/* ---------- 업종·테마 */
.sectors { display: flex; flex-direction: column; }
.sector { display: grid; grid-template-columns: 220px 1fr; gap: 18px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.sector:first-child { border-top: 0; }
.sector .t b { font-size: var(--fs-md); display: block; }
.sector .t .d { color: var(--muted); font-size: var(--fs-xs); }
.sector .t .avg { margin-top: 6px; font-size: var(--fs-sm); font-weight: 650; }
.mem { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.mem a { display: inline-flex; gap: 6px; align-items: baseline; padding: 5px 10px; border-radius: var(--r-sm); text-decoration: none; font-size: var(--fs-sm); border: 1px solid var(--line-soft); background: var(--sunken); }
.mem a:hover { border-color: var(--brand); }
.mem a .g { font-size: 11px; color: var(--muted); font-weight: 700; }
.mem a.g-A { background: var(--surface); border-color: var(--line); }
.mem a.g-C { opacity: .72; }

/* ---------- 상세 */
.back { display: inline-block; margin-bottom: 10px; color: var(--muted); text-decoration: none; font-size: var(--fs-sm); }
.back:hover { color: var(--brand); }
.hero { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: end; margin-bottom: 18px; }
.hero h1 { margin: 0; font-size: var(--fs-2xl); font-weight: 780; letter-spacing: -0.03em; line-height: 1.15; }
.hero .idline { color: var(--muted); font-size: var(--fs-sm); margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hero .px { text-align: right; }
.hero .px b { display: block; font-size: var(--fs-2xl); font-weight: 760; letter-spacing: -0.02em; line-height: 1.1; }
.hero .px span { font-size: var(--fs-md); font-weight: 650; }
.hero .px small { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }

.stats { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 16px; }
.stats div { padding: 12px 14px; border-left: 1px solid var(--line-soft); }
.stats div:first-child { border-left: 0; }
.stats span { display: block; color: var(--muted); font-size: var(--fs-xs); }
.stats b { font-size: var(--fs-lg); font-weight: 700; }

.chartbox { position: relative; height: 440px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; font-size: var(--fs-xs); color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 2px; vertical-align: 3px; margin-right: 4px; }

.reccard { border-top: 1px solid var(--line-soft); padding: 14px 0; }
.reccard:first-of-type { border-top: 0; padding-top: 0; }
.reccard .top { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 6px; }
.reccard .top .l { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--muted); }
.reccard .reason { font-size: var(--fs-sm); color: var(--ink-2); margin: 8px 0 0; }
.reccard .notes { font-size: var(--fs-xs); color: var(--muted); margin: 6px 0 0; }
.reccard .checks { margin-top: 10px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 12px; }
.tabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; font-weight: 650; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs button span { font-weight: 500; font-size: var(--fs-xs); margin-left: 3px; }

.sector-notes { display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-sm); }
.sector-notes .row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: baseline; }
.sector-notes .row .n { color: var(--muted); font-size: var(--fs-xs); }

.loading { color: var(--muted); padding: 60px 0; text-align: center; }
.err { background: var(--warn-soft); color: var(--warn); padding: 14px 16px; border-radius: var(--r-sm); }

@media (max-width: 1100px) {
  .g-main, .g-3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats div:nth-child(5) { border-left: 0; }
  .stats div:nth-child(n+5) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .rail .brand { padding: 8px 12px; width: 100%; }
  .jump { display: none; }
  main { padding: 18px 16px 48px; }
  .g-2 { grid-template-columns: 1fr; }
  .rec { grid-template-columns: 1fr; gap: 8px; }
  .rec .res { text-align: left; }
  .sector { grid-template-columns: 1fr; gap: 8px; }
  .hero { grid-template-columns: 1fr; }
  .hero .px { text-align: left; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* 브리핑 */
.brief-card { display: block; margin-bottom: 16px; color: inherit; text-decoration: none; border-left: 4px solid var(--brand); }
.brief-card:hover { border-color: var(--brand); }
.brief-meta { color: var(--muted); font-size: var(--fs-xs); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.brief-head { font-size: var(--fs-lg); font-weight: 700; margin: 6px 0 4px; letter-spacing: -0.01em; }
h1.brief-head { line-height: 1.4; }
.brief-market { margin: 4px 0 6px; color: var(--ink-2); line-height: 1.6; }
.brief-more { font-size: var(--fs-sm); color: var(--brand); font-weight: 600; }
.g-brief { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; }
.md { line-height: 1.7; color: var(--ink); margin-top: 12px; }
.md h2, .md h3, .md h4 { margin: 20px 0 8px; font-size: var(--fs-md, 15px); font-weight: 700; }
.md h2 { font-size: var(--fs-lg); }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 20px; }
.md li { margin: 3px 0; }
.md code { background: var(--sunken); padding: 1px 5px; border-radius: 4px; font-size: 0.92em; }
.md .tbl-wrap { margin: 10px 0; }
.brief-list li a { display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; width: 100%; }
.brief-list li.on a .what b { color: var(--brand); }
.brief-list .side { color: var(--muted); font-size: var(--fs-xs); text-align: left; }
@media (max-width: 900px) { .g-brief { grid-template-columns: 1fr; } }

/* 백테스트 */
.bt-form form { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.bt-form label, .bt-form .fld { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.bt-form input[type=date], .bt-form input[type=number] { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; }
.bt-form input[type=number] { width: 84px; }
.bt-form .inl, .inl { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 500; }
.bt-form .dim { opacity: .45; }
.bt-form label.chk { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 8px; color: var(--ink-2); }
.go { padding: 8px 18px; border: 0; border-radius: var(--r-sm); background: var(--brand); color: #fff; font-weight: 700; cursor: pointer; }
.go.sm { padding: 5px 12px; }
.bt-form .notes { margin: 12px 0 0; }
.bt-sum { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; padding: 16px 20px 12px; }
.bt-sum .flat { margin-left: auto; font-size: var(--fs-xs); }
.bt-tbl tbody tr { cursor: pointer; }
#zzf { font-size: var(--fs-sm); color: var(--muted); }
#zzf input { padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit; }
.bt-tabs { margin-bottom: 14px; }
.bt-tabs a { padding: 7px 14px; font-weight: 600; color: var(--muted); text-decoration: none; }
.bt-tabs a + a { border-left: 1px solid var(--line); }
.bt-tabs a.on { background: var(--ink); color: #fff; }
.bt-rule { margin-top: 14px; padding: 12px 16px; background: var(--sunken); border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.65; }
.bt-rule ol { margin: 6px 0 0; padding-left: 20px; }
.bt-form .sgn { font-size: var(--fs-lg); color: var(--ink); margin-right: 2px; }

/* 로그인 */
.acct { margin-top: auto; padding: 12px 4px 10px; border-top: 1px solid #2b3742; display: flex; flex-direction: column; gap: 6px; }
.acct a { padding: 8px 12px; }
.acct .who { font-size: var(--fs-sm); color: #fff; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct button { align-self: flex-start; margin-left: 8px; background: none; border: 1px solid #3a4754; color: #c9d2db; border-radius: var(--r-sm); padding: 4px 10px; font-size: var(--fs-xs); cursor: pointer; }
.acct button:hover { color: #fff; border-color: #6b7884; }
.acct + .jump { margin-top: 0; }
.auth { max-width: 420px; margin: 40px auto; padding: 28px 28px 22px; }
.auth h1 { margin: 0; font-size: var(--fs-xl); font-weight: 750; letter-spacing: -0.02em; }
.auth .sub { color: var(--muted); font-size: var(--fs-sm); margin: 4px 0 22px; }
.auth form { display: flex; flex-direction: column; gap: 14px; }
.auth label { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.auth label em.opt { font-style: normal; font-weight: 500; color: var(--muted); font-size: var(--fs-xs); margin-left: 2px; }
.auth input { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-size: var(--fs-md); font-weight: 400; color: var(--ink); }
.auth input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.auth .hint { margin: -4px 0 0; min-height: 1.4em; font-size: var(--fs-xs); color: var(--muted); }
.auth .hint.bad { color: var(--up); }
.auth .hint.good { color: var(--brand); }
.auth .err { margin: 0; padding: 10px 12px; font-size: var(--fs-sm); }
.auth button.primary { margin-top: 4px; padding: 11px; border: 0; border-radius: var(--r-sm); background: var(--brand); color: #fff; font-weight: 700; cursor: pointer; }
.auth button.primary:disabled { opacity: .6; cursor: default; }
.auth .alt { margin: 18px 0 0; text-align: center; font-size: var(--fs-sm); color: var(--muted); }
.auth .alt a { color: var(--brand); font-weight: 600; }
@media (max-width: 760px) {
  .acct { margin-top: 0; border-top: 0; padding: 0; flex-direction: row; align-items: center; width: 100%; }
  .auth { margin: 12px auto; padding: 22px 18px; }
}

/* 매매일지 */
.btn { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-weight: 650; cursor: pointer; text-decoration: none; font-size: var(--fs-sm); }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.auth a.btn.primary { display: block; text-align: center; padding: 11px; font-size: var(--fs-md); }
.linkbtn { background: none; border: 0; padding: 2px 6px; color: var(--brand); font-weight: 600; cursor: pointer; font-size: var(--fs-sm); }
.linkbtn.danger { color: var(--muted); }
.linkbtn.danger:hover { color: var(--up); }
.panel h2 .linkbtn { margin-left: auto; }
.chip.j-buy { background: var(--up-soft); color: var(--up); border-color: transparent; }
.chip.j-sell { background: var(--down-soft); color: var(--down); border-color: transparent; }
.seg a { display: inline-block; padding: 7px 14px; text-decoration: none; font-weight: 600; color: var(--muted); }
.seg a + a { border-left: 1px solid var(--line); }
.seg a.on { background: var(--ink); color: #fff; }
.jtabs { margin-bottom: 16px; }
.stats.n6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tbl td.memo { min-width: 200px; max-width: 360px; color: var(--ink-2); font-size: var(--fs-sm); }
.tbl td.acts { text-align: right; }
.muted { color: var(--muted); }
.jform { margin-bottom: 16px; border-left: 4px solid var(--brand); }
.jform form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
.jform label, .jform .fld { display: flex; flex-direction: column; gap: 5px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); min-width: 0; }
.jform .wide { grid-column: 1 / -1; }
.jform label.wide { grid-column: span 2; }
.jform label.wide:has(textarea) { grid-column: 1 / -1; }
.jform input, .jform select, .jform textarea, .jfees input, .jround textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-weight: 400; color: var(--ink); min-width: 0; width: 100%; }
.jform input:disabled { background: var(--sunken); color: var(--muted); }
.jform input:focus, .jform select:focus, .jform textarea:focus, .jfees input:focus, .jround textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.jform label.chk { flex-direction: row; align-items: center; gap: 8px; padding-bottom: 9px; }
.jform label.chk input { width: auto; }
.jform em.opt { font-style: normal; font-weight: 500; color: var(--muted); font-size: var(--fs-xs); }
.jform .seg button { padding: 8px 18px; }
.jsum { display: flex; flex-wrap: wrap; gap: 6px 18px; background: var(--sunken); border-radius: var(--r-sm); padding: 10px 12px; font-size: var(--fs-sm); color: var(--ink-2); }
.jform .err { margin: 0; }
.jform .acts { display: flex; justify-content: flex-end; }
.jform .acts .primary { padding: 10px 28px; border: 0; border-radius: var(--r-sm); background: var(--brand); color: #fff; font-weight: 700; cursor: pointer; }
.jfees form { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
.jfees label { display: grid; grid-template-columns: 1fr 110px auto; gap: 10px; align-items: center; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.jround { border-top: 1px solid var(--line-soft); padding: 14px 0; }
.jround:first-of-type { border-top: 0; padding-top: 0; }
.jround .top { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: 8px; }
.jround .top b:first-child { color: var(--ink); font-size: var(--fs-md); }
.jround .rv { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.jround label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
@media (max-width: 1100px) { .stats.n6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .jform form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .stats.n6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jform form { grid-template-columns: 1fr; }
  .jform label.wide { grid-column: 1 / -1; }
  .jround .rv { grid-template-columns: 1fr; }
  .jfees label { grid-template-columns: 1fr 90px auto; }
  .jtabs { display: flex; overflow-x: auto; }
}
/* 숫자 칸 안의 색 표시(+1.2% 등)는 라벨 글씨체를 따르지 않게 */
.stats b span { display: inline; font-size: inherit; color: inherit; }
.stats b span.up { color: var(--up); }
.stats b span.down { color: var(--down); }
.stats b span.flat { color: var(--muted); }
@media (max-width: 760px) { .rail { align-items: center; } .acct { margin-top: 6px; } }
.jfees form > .btn { align-self: flex-start; padding: 9px 28px; }
/* 나의 매매원칙 */
.rules { margin-bottom: 16px; border-left: 4px solid var(--warn); background: #fffdf8; }
.rules h2 { margin-bottom: 8px; }
.rules h2 small { margin-right: auto; margin-left: 8px; }
.rules-body { white-space: pre-wrap; line-height: 1.75; color: var(--ink); font-size: var(--fs-md); }
.rules textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit; line-height: 1.7; resize: vertical; }
.rules textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.rules .racts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.rules .err { margin: 8px 0 0; }
/* 뉴스 묶음·중요 */
.chip.sm { font-size: 11px; padding: 0 6px; line-height: 18px; vertical-align: 1px; }
.chip.story { text-decoration: none; color: var(--muted); }
.chip.story:hover { color: var(--brand); border-color: var(--brand); }
.toolbar label.chk { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-sm); color: var(--ink-2); }

.stats b em.sub { display: block; font-style: normal; font-weight: 500; font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }

/* 2026-10-16 백테스트 탭·선택 버튼이 좁은 화면에서 넘치지 않게 */
.bt-tabs, .bt-form .seg { flex-wrap: wrap; max-width: 100%; }
.bt-form .fld, .bt-form label { min-width: 0; max-width: 100%; }
main { min-width: 0; }   /* 넓은 표가 있어도 화면 폭을 넘지 않게 (표는 .tbl-wrap 안에서 가로 스크롤) */
.bt-tbl tbody tr.on td { background: #eef3fb; }   /* 전수검사 종목 화면: 고른 거래 (2026-10-19) */
[hidden] { display: none !important; }
