:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #fcfcfb;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7a7974;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --s1: #2a78d6;  /* 에이전트 */
  --s2: #eb6834;  /* SPY */
  --s3: #1baf7a;  /* SMI */
  --good: #006300;
  --good-fill: #0ca30c;
  --bad: #d03b3b;
  --chip: #ecebe6;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110; --surface: #1a1a19; --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e88;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70;
    --good: #0ca30c; --good-fill: #0ca30c; --bad: #e66767; --chip: #262624;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e88;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70;
  --good: #0ca30c; --good-fill: #0ca30c; --bad: #e66767; --chip: #262624;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 Inter, "Noto Sans KR", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
h1, h2 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; font-weight: 600; }
.num, td.n, .kpi .v { font-variant-numeric: tabular-nums; }

.top { background: var(--surface); border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.top-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--s1) url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path d='M7 21l6-6 4 4 8-9' stroke='white' stroke-width='3' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/80% no-repeat; }
.sub { margin: 0; color: var(--text-2); font-size: 13px; }
.meta { color: var(--text-2); font-size: 13px; text-align: right; }

.kpis { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .l { color: var(--text-2); font-size: 13px; }
.kpi .v { font-size: 24px; font-weight: 600; margin-top: 2px; letter-spacing: -0.02em; }
.kpi .d { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.kpi.hero .v { font-size: 32px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, 1fr); } .kpi.hero { grid-column: span 2; } }

.up { color: var(--good); }
.down { color: var(--bad); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.hint { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.grid2 .card { margin-bottom: 0; }
.grid2 { margin-bottom: 16px; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }

.chart-box { position: relative; height: 220px; }
.chart-box.tall { height: 320px; }
@media (max-width: 520px) { .chart-box.tall { height: 260px; } }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.dash { background: none !important; border-top: 2px dashed; height: 0; }

.seg { display: inline-flex; background: var(--chip); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
td.n, th.n { text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .sym { font-weight: 600; }
td .nm { color: var(--muted); font-size: 12px; display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.reason { color: var(--text-2); font-size: 13px; min-width: 200px; }
.empty { color: var(--muted); padding: 16px 0; text-align: center; }
.bar { height: 6px; background: var(--chip); border-radius: 3px; width: 80px; display: inline-block; vertical-align: middle; margin-left: 6px; }
.bar > b { display: block; height: 100%; background: var(--s1); border-radius: 3px; }

.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--chip); color: var(--text-2); white-space: nowrap; }
.tag.buy { color: var(--good); }
.tag.sell { color: var(--bad); }

.pending { margin-top: 12px; padding: 12px; border-radius: 8px; background: var(--chip); font-size: 14px; color: var(--text-2); }
.pending b { color: var(--text); }

.decomp { display: grid; gap: 14px; }
.drow .top2 { display: flex; justify-content: space-between; font-size: 14px; }
.drow .top2 span:first-child { color: var(--text-2); }
.drow .track { position: relative; height: 10px; background: var(--chip); border-radius: 5px; margin-top: 6px; }
.drow .track .mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--axis); }
.drow .track b { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.decomp .foot2 { color: var(--muted); font-size: 13px; border-top: 1px solid var(--grid); padding-top: 10px; }

.pred-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.pstat { background: var(--chip); border-radius: 8px; padding: 10px 12px; }
.pstat .l { font-size: 12px; color: var(--text-2); }
.pstat .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }

details.j { border-top: 1px solid var(--grid); }
details.j:first-of-type { border-top: 0; }
details.j summary { cursor: pointer; padding: 10px 0; display: flex; justify-content: space-between; gap: 12px; list-style: none; }
details.j summary::-webkit-details-marker { display: none; }
details.j summary .d { font-weight: 600; }
details.j summary .s { color: var(--text-2); font-size: 13px; text-align: right; }
details.j .md { padding: 0 0 14px; font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.md h1 { font-size: 17px; margin: 8px 0; }
.md h2 { font-size: 15px; margin: 14px 0 4px; }
.md ul { padding-left: 20px; margin: 4px 0; }
.md p { margin: 6px 0; }
.md table { font-size: 13px; }

.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,.12); min-width: 160px; }
.tip .t { color: var(--text-2); margin-bottom: 4px; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.tip .r i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.foot { color: var(--muted); font-size: 12px; padding: 8px 0 32px; line-height: 1.7; }
@media (max-width: 600px) { .meta { text-align: left; } }
