Spaces:
Runtime error

ditgun commited on
Commit
7652dec
ยท
verified ยท
1 Parent(s): 8b7b3f7

Update src/app.py

Browse files
Files changed (1) hide show
  1. src/app.py +307 -282
src/app.py CHANGED
@@ -34,7 +34,7 @@ div.element-container:has(.nav-marker) + div {
34
  backdrop-filter: blur(20px) !important;
35
  -webkit-backdrop-filter: blur(20px) !important;
36
  z-index: 999999 !important;
37
- border-top: 1px solid rgba(255,255,255,0.07) !important;
38
  padding-bottom: env(safe-area-inset-bottom) !important;
39
  }
40
  div.element-container:has(.nav-marker) + div [data-testid="stColumns"],
@@ -48,17 +48,17 @@ div.element-container:has(.nav-marker) + div [data-testid="stColumn"] {
48
  }
49
  div.element-container:has(.nav-marker) + div button {
50
  background: transparent !important; border: none !important; box-shadow: none !important;
51
- color: #4A5568 !important; width: 100% !important; height: 58px !important;
52
  padding: 0 !important; display: block !important; transition: color 0.2s;
53
  }
54
  div.element-container:has(.nav-marker) + div button p {
55
  white-space: pre-wrap !important; text-align: center !important;
56
  font-size: 10px !important; font-weight: 700 !important; line-height: 1.2 !important;
57
- margin: 0 !important; color: #4A5568 !important; letter-spacing: 0.5px !important;
58
  }
59
  div.element-container:has(.nav-marker) + div button em {
60
  font-style: normal !important; font-size: 20px !important; display: block !important;
61
- margin-bottom: 3px !important; color: #4A5568 !important;
62
  }
63
  div.element-container:has(.nav-marker) + div button:hover p,
64
  div.element-container:has(.nav-marker) + div button:active p { color: #C9A84C !important; }
@@ -82,15 +82,15 @@ div.element-container:has(.action-marker) + div button {
82
  font-size: 16px !important; display: flex !important; justify-content: center !important;
83
  align-items: center !important; transition: all 0.2s !important;
84
  }
85
- div.element-container:has(.action-marker.delete) + div button:hover { color: #E53E3E !important; transform: scale(1.15) !important; }
86
- div.element-container:has(.action-marker.edit) + div button:hover { color: #4299E1 !important; transform: scale(1.15) !important; }
87
  div.element-container:has(.action-marker.log) + div button:hover { color: #C9A84C !important; transform: scale(1.15) !important; }
88
  """
89
 
90
  CARD_CSS = """
91
  div.element-container:has(.scan-marker) + div.element-container button {
92
- background: #0F1623 !important;
93
- border: 1px solid rgba(255,255,255,0.07) !important;
94
  border-radius: 10px !important;
95
  padding: 18px 10px !important; display: flex !important; flex-direction: column !important;
96
  align-items: center !important; justify-content: center !important; width: 100% !important;
@@ -100,7 +100,7 @@ div.element-container:has(.scan-marker) + div.element-container button {
100
  }
101
  div.element-container:has(.scan-marker) + div.element-container button:hover {
102
  border-color: rgba(201,168,76,0.4) !important;
103
- background: #161E2E !important;
104
  transform: translateY(-2px) !important;
105
  box-shadow: 0 8px 20px rgba(0,0,0,0.3) !important;
106
  }
@@ -116,15 +116,15 @@ div.element-container:has(.scan-marker) + div.element-container button em {
116
  border: 1px solid rgba(201,168,76,0.2) !important;
117
  }
118
  div.element-container:has(.scan-marker) + div.element-container button strong {
119
- font-size: 14px !important; font-weight: 700 !important; color: #EEF2F7 !important;
120
  display: block !important; margin-bottom: 5px !important;
121
  }
122
  div.element-container:has(.scan-marker) + div.element-container button del {
123
  text-decoration: none !important; font-size: 13px !important; font-weight: 500 !important;
124
- color: #8B98B4 !important; display: block !important; font-family: 'DM Mono', monospace !important;
125
  }
126
  div.element-container:has(.port-marker) + div.element-container button {
127
- background: linear-gradient(135deg, #0F1623 0%, #131C2F 100%) !important;
128
  border: 1px solid rgba(201,168,76,0.25) !important;
129
  border-radius: 16px !important;
130
  padding: 26px 20px !important; text-align: center !important;
@@ -138,78 +138,89 @@ div.element-container:has(.port-marker) + div.element-container button:hover {
138
  }
139
  div.element-container:has(.port-marker) + div.element-container button p {
140
  white-space: pre-wrap !important; font-size: 11px !important; font-weight: 700 !important;
141
- color: #4A5568 !important; line-height: 1.8 !important; letter-spacing: 1px !important;
142
  text-transform: uppercase !important;
143
  }
144
  div.element-container:has(.port-marker) + div.element-container button del {
145
  text-decoration: none !important; font-size: 28px !important; font-weight: 500 !important;
146
- color: #EEF2F7 !important; display: block !important; margin: 6px 0 !important;
147
  font-family: 'DM Mono', monospace !important; letter-spacing: -1px !important;
148
  }
149
  div.element-container:has(.port-marker) + div.element-container button strong {
150
- color: #E53E3E !important; font-size: 14px !important;
151
  font-family: 'DM Mono', monospace !important; font-weight: 700 !important;
152
  }
153
  """
154
 
155
  COMPONENT_CSS = """
156
  .menu-overlay-btn > button {
157
- background: #0F1623 !important;
158
- border: 1px solid rgba(255,255,255,0.07) !important;
159
  border-radius: 12px !important;
160
  padding: 18px 20px !important; font-size: 16px !important; font-weight: 700 !important;
161
- color: #EEF2F7 !important; box-shadow: none !important; margin-bottom: 10px !important;
162
  transition: all 0.15s !important;
163
  }
164
  .menu-overlay-btn > button:hover {
165
  border-color: rgba(201,168,76,0.35) !important;
166
- background: #161E2E !important;
167
  }
168
  .menu-overlay-btn > button p {
169
- font-size: 16px !important; font-weight: 400 !important; margin: 0 !important; color: #EEF2F7 !important;
170
  }
171
  div.stButton > button:not([title]) {
172
- border-radius: 8px; font-weight: 600; padding: 10px 20px; transition: all 0.15s ease;
173
- border: 1px solid rgba(255,255,255,0.1); width: 100%; word-break: keep-all;
174
- color: #8B98B4; background: #0F1623; font-size: 13px;
 
175
  }
176
  div.stButton > button:not([title]):hover {
177
- border-color: rgba(201,168,76,0.35);
178
  color: #C9A84C;
179
- background: #161E2E;
 
 
180
  }
181
  button[kind="primary"]:not([title]) {
182
- background: rgba(201,168,76,0.12) !important;
183
- border-color: rgba(201,168,76,0.25) !important;
184
  color: #C9A84C !important;
 
185
  }
186
  button[kind="primary"]:not([title]):hover {
187
- background: rgba(201,168,76,0.2) !important;
 
188
  }
189
  @keyframes skeleton-pulse {
190
- 0% { background-color: #0F1623; }
191
- 50% { background-color: #161E2E; }
192
- 100% { background-color: #0F1623; }
193
  }
194
  .skeleton-box { border-radius: 10px; animation: skeleton-pulse 1.5s ease-in-out infinite; }
195
  .stock-header-card {
196
- background: #0F1623;
197
- border: 1px solid rgba(255,255,255,0.07);
198
  border-radius: 16px; padding: 24px;
199
  margin-bottom: 16px; position: relative; overflow: hidden;
 
200
  }
201
  .stock-header-card::before {
202
  content: '';
203
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
204
- background: linear-gradient(90deg, transparent, rgba(201,168,76,0.4), transparent);
 
 
 
 
 
205
  }
206
  .stock-title {
207
- font-size: 10px; color: #4A5568; font-weight: 700;
208
  text-transform: uppercase; letter-spacing: 2px; margin-bottom: 14px;
209
  display: flex; align-items: center; justify-content: space-between;
210
  }
211
  .stock-name-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
212
- .stock-name { font-size: 28px; font-weight: 900; color: #EEF2F7; }
213
  .stock-ticker {
214
  font-size: 13px; color: #C9A84C;
215
  background: rgba(201,168,76,0.1); padding: 2px 8px;
@@ -217,7 +228,7 @@ button[kind="primary"]:not([title]):hover {
217
  }
218
  .price-star-row {
219
  display: flex; align-items: center; justify-content: space-between;
220
- border-top: 1px solid rgba(255,255,255,0.06); padding-top: 18px;
221
  }
222
  .stock-price {
223
  font-size: 36px; font-weight: 500; color: #C9A84C;
@@ -229,68 +240,82 @@ button[kind="primary"]:not([title]):hover {
229
  border-radius: 6px; border: 1px solid rgba(201,168,76,0.2);
230
  }
231
  .conclusion-box {
232
- background: #0F1623;
233
- color: #8B98B4;
234
  border-radius: 10px; padding: 20px;
235
  margin-bottom: 20px;
 
236
  border-left: 3px solid #C9A84C;
237
- border: 1px solid rgba(255,255,255,0.07);
238
- border-left-width: 3px;
239
  font-size: 14px; line-height: 1.8;
 
 
 
 
 
 
 
240
  }
241
- .conclusion-box strong { color: #EEF2F7; }
242
- .report-section { margin-bottom: 16px; }
243
  .analysis-header {
244
- background: rgba(201,168,76,0.08);
245
  color: #C9A84C; padding: 7px 14px; border-radius: 6px;
246
  font-weight: 700; font-size: 11px; width: fit-content; margin-bottom: 12px;
247
- border: 1px solid rgba(201,168,76,0.15); letter-spacing: 1px; text-transform: uppercase;
 
 
 
248
  }
249
- .analysis-content { line-height: 1.9; font-size: 14px; color: #8B98B4; }
250
- .analysis-content strong { color: #EEF2F7; font-weight: 700; }
251
  .strategy-badge {
252
  padding: 3px 10px; border-radius: 4px; font-size: 11px;
253
  font-weight: 700; display: inline-block; letter-spacing: 0.3px;
254
  }
255
- .badge-buy { background: rgba(229,62,62,0.1); color: #E53E3E; border: 1px solid rgba(229,62,62,0.2); }
256
- .badge-hold { background: rgba(255,255,255,0.04); color: #8B98B4; border: 1px solid rgba(255,255,255,0.08); }
257
- .badge-profit { background: rgba(66,153,225,0.1); color: #4299E1; border: 1px solid rgba(66,153,225,0.2); }
258
- .badge-loss { background: rgba(255,255,255,0.03); color: #4A5568; border: 1px solid rgba(255,255,255,0.06); }
259
- .badge-none { background: transparent; color: #4A5568; border: 1px dashed rgba(255,255,255,0.08); }
260
  .strat-summary-card {
261
- background: #0F1623; padding: 16px; border-radius: 10px;
262
- border: 1px solid rgba(255,255,255,0.07);
 
 
263
  }
264
  .inline-edit-box {
265
- background: #0B1020; padding: 16px; border-radius: 10px;
266
- border: 1px dashed rgba(201,168,76,0.2); margin-bottom: 12px;
 
267
  }
268
  .onboarding-step {
269
- background: #0F1623; border-radius: 10px; padding: 14px 16px; margin-bottom: 10px;
 
 
270
  border-left: 3px solid #C9A84C;
271
- border: 1px solid rgba(255,255,255,0.07); border-left-width: 3px;
272
- color: #8B98B4; font-size: 14px;
273
  }
274
  .analytics-metric {
275
- background: #0F1623; border: 1px solid rgba(255,255,255,0.07);
 
276
  border-radius: 10px; padding: 18px; text-align: center;
 
277
  }
278
  .analytics-metric .metric-label {
279
- font-size: 10px; font-weight: 700; color: #4A5568;
280
  margin-bottom: 6px; letter-spacing: 1.5px; text-transform: uppercase;
281
  }
282
- .analytics-metric .metric-value { font-size: 24px; font-weight: 700; color: #EEF2F7; font-family: 'DM Mono', monospace; }
283
  .data-badge-ok {
284
  display: inline-flex; align-items: center;
285
- background: rgba(34,197,94,0.08); color: #4ADE80;
286
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 4px;
287
  border: 1px solid rgba(74,222,128,0.2); letter-spacing: 0.3px;
288
  }
289
  .data-badge-warn {
290
  display: inline-flex; align-items: center;
291
- background: rgba(234,179,8,0.08); color: #EAB308;
292
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 4px;
293
- border: 1px solid rgba(234,179,8,0.2);
294
  }
295
  @keyframes alertPulse {
296
  0%, 100% { opacity: 1; }
@@ -304,15 +329,15 @@ def load_css():
304
  @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700;900&family=DM+Mono:wght@400;500&display=swap');
305
  * {{ font-family: 'Noto Sans KR', sans-serif; letter-spacing: -0.2px; }}
306
  .main, [data-testid="stAppViewContainer"] {{
307
- background-color: #080C14 !important;
308
  }}
309
- [data-testid="stMain"] {{ background-color: #080C14 !important; }}
310
  header[data-testid="stHeader"] {{ display: none !important; }}
311
  .block-container {{ padding-top: 1.5rem !important; padding-bottom: 120px !important; }}
312
- p, span, div, label, li {{ color: #8B98B4; }}
313
- h1, h2, h3, h4 {{ color: #EEF2F7 !important; }}
314
- .stMarkdown p {{ color: #8B98B4; }}
315
- hr {{ border-color: rgba(255,255,255,0.06) !important; }}
316
  div.stButton:has(button[title="header_logo"]) {{
317
  background: transparent !important;
318
  }}
@@ -346,57 +371,57 @@ def load_css():
346
  outline: none !important;
347
  }}
348
  [data-testid="stTextInput"] input {{
349
- background: #0F1623 !important;
350
- border: 1px solid rgba(255,255,255,0.08) !important;
351
  border-radius: 8px !important;
352
- color: #EEF2F7 !important;
353
  font-size: 14px !important;
354
  }}
355
  [data-testid="stTextInput"] input:focus {{
356
  border-color: rgba(201,168,76,0.4) !important;
357
  box-shadow: 0 0 0 2px rgba(201,168,76,0.08) !important;
358
  }}
359
- [data-testid="stTextInput"] input::placeholder {{ color: #4A5568 !important; }}
360
  [data-testid="stNumberInput"] input {{
361
- background: #0F1623 !important;
362
- border: 1px solid rgba(255,255,255,0.08) !important;
363
  border-radius: 8px !important;
364
- color: #EEF2F7 !important;
365
  }}
366
  [data-testid="stSelectbox"] > div > div {{
367
- background: #0F1623 !important;
368
- border: 1px solid rgba(255,255,255,0.08) !important;
369
  border-radius: 8px !important;
370
- color: #EEF2F7 !important;
371
  }}
372
  [data-testid="stExpander"] {{
373
- background: #0F1623 !important;
374
- border: 1px solid rgba(255,255,255,0.07) !important;
375
  border-radius: 10px !important;
376
  }}
377
  [data-testid="stExpander"] summary {{
378
- color: #8B98B4 !important;
379
  }}
380
  [data-testid="stVerticalBlock"] > [data-testid="stVerticalBlockBorderWrapper"] {{
381
- background: #0F1623 !important;
382
- border: 1px solid rgba(255,255,255,0.07) !important;
383
  border-radius: 12px !important;
384
  }}
385
  [data-testid="stTabs"] [data-testid="stTab"] {{
386
- color: #4A5568 !important; font-weight: 600 !important; font-size: 13px !important;
387
  }}
388
  [data-testid="stTabs"] [data-testid="stTab"][aria-selected="true"] {{
389
  color: #C9A84C !important; border-bottom-color: #C9A84C !important;
390
  }}
391
  [data-testid="stSpinner"] {{ color: #C9A84C !important; }}
392
  [data-testid="stAlert"] {{
393
- background: #0F1623 !important; border-color: rgba(255,255,255,0.08) !important;
394
- color: #8B98B4 !important; border-radius: 8px !important;
395
  }}
396
  [data-testid="stSuccess"] {{
397
  background: rgba(74,222,128,0.06) !important;
398
  border-color: rgba(74,222,128,0.15) !important;
399
- color: #4ADE80 !important; border-radius: 8px !important;
400
  }}
401
  [data-testid="stError"] {{
402
  background: rgba(229,62,62,0.06) !important;
@@ -405,7 +430,7 @@ def load_css():
405
  }}
406
  [data-testid="stMarkdownContainer"] hr + p,
407
  [data-testid="stMarkdownContainer"] h3 {{
408
- color: #EEF2F7 !important;
409
  }}
410
  iframe[title="components.v1.html"] {{
411
  width: 1px !important;
@@ -474,8 +499,8 @@ st.button("โฌข INVEST PRO ALPHA", key="header_logo_btn", help="header_logo", on_
474
  if not st.session_state.api_key:
475
  st.markdown("""
476
  <div style="text-align:center; padding:40px 10px 60px;">
477
- <div style="font-size:13px; color:#4A5568; margin-bottom:6px; letter-spacing:2px; text-transform:uppercase;">SYSTEM ACCESS</div>
478
- <p style="color:#8B98B4; font-size:14px; line-height:1.9;">
479
  ์•ˆ์ „ํ•œ ์‹ค์ „ ๋งค๋งค ๋ถ„์„์„ ์œ„ํ•ด<br>Gemini API KEY๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.
480
  </p>
481
  </div>
@@ -1160,22 +1185,22 @@ def render_confidence_bar(score, reason):
1160
  if score >= 75:
1161
  color, label, emoji = "#4ADE80", "๋†’์Œ", "๐ŸŸข"
1162
  elif score >= 45:
1163
- color, label, emoji = "#EAB308", "๋ณดํ†ต", "๐ŸŸก"
1164
  else:
1165
- color, label, emoji = "#E53E3E", "๋‚ฎ์Œ", "๐Ÿ”ด"
1166
 
1167
  st.markdown(
1168
- f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); '
1169
  f'border-radius:10px; padding:14px 16px; margin-bottom:12px;">'
1170
  f'<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">'
1171
- f'<span style="font-size:11px; font-weight:700; color:#4A5568; letter-spacing:1px; text-transform:uppercase;">'
1172
  f'{emoji} AI ๋ถ„์„ ์‹ ๋ขฐ๋„</span>'
1173
  f'<span style="font-size:16px; font-weight:900; color:{color};">{score}์  ยท {label}</span>'
1174
  f'</div>'
1175
- f'<div style="background:rgba(255,255,255,0.05); border-radius:4px; height:6px; margin-bottom:8px;">'
1176
  f'<div style="background:{color}; width:{score}%; height:6px; border-radius:4px; '
1177
  f'transition:width 0.6s ease;"></div></div>'
1178
- f'<div style="font-size:12px; color:#4A5568;">{reason}</div>'
1179
  f'</div>',
1180
  unsafe_allow_html=True
1181
  )
@@ -1194,35 +1219,35 @@ def render_target_price_compare(ai_target_str, analyst_target_krw, current_price
1194
 
1195
  if diff_pct >= 30:
1196
  warn_html = (
1197
- f'<div style="background:rgba(234,179,8,0.08); border:1px solid rgba(234,179,8,0.25); '
1198
- f'border-radius:6px; padding:8px 12px; margin-top:10px; font-size:12px; color:#EAB308;">'
1199
  f'โš ๏ธ AI ๋ชฉํ‘œ๊ฐ€์™€ ์‹ค์ œ ์• ๋„๋ฆฌ์ŠคํŠธ ๋ชฉํ‘œ๊ฐ€๊ฐ€ <b>{diff_pct:.0f}%</b> ์ฐจ์ด๋‚ฉ๋‹ˆ๋‹ค.</div>'
1200
  )
1201
  else:
1202
  warn_html = (
1203
- f'<div style="background:rgba(74,222,128,0.05); border:1px solid rgba(74,222,128,0.15); '
1204
- f'border-radius:6px; padding:8px 12px; margin-top:10px; font-size:12px; color:#4ADE80;">'
1205
  f'โœ… AI ๋ชฉํ‘œ๊ฐ€์™€ ์‹ค์ œ ์• ๋„๋ฆฌ์ŠคํŠธ ๋ชฉํ‘œ๊ฐ€๊ฐ€ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค (์ฐจ์ด {diff_pct:.0f}%).</div>'
1206
  )
1207
 
1208
  st.markdown(
1209
- f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); '
1210
  f'border-radius:10px; padding:16px; margin-bottom:12px;">'
1211
- f'<div style="font-size:11px; font-weight:700; color:#4A5568; letter-spacing:1px; '
1212
  f'text-transform:uppercase; margin-bottom:12px;">๐Ÿ“Š ๋ชฉํ‘œ๊ฐ€ ๋น„๊ต</div>'
1213
  f'<div style="display:grid; grid-template-columns:1fr 1fr; gap:10px;">'
1214
- f'<div style="background:#080C14; border-radius:8px; padding:12px; text-align:center;">'
1215
- f'<div style="font-size:10px; color:#4A5568; margin-bottom:4px;">AI ๋ถ„์„ ๋ชฉํ‘œ๊ฐ€</div>'
1216
  f'<div style="font-size:18px; font-weight:700; color:#C9A84C; font-family:DM Mono,monospace;">'
1217
  f'{ai_price:,}์›</div>'
1218
- f'<div style="font-size:11px; color:{"#E53E3E" if ai_upside>=0 else "#4299E1"}; margin-top:4px;">'
1219
  f'ํ˜„์žฌ๊ฐ€ ๋Œ€๋น„ {ai_upside:+.1f}%</div>'
1220
  f'</div>'
1221
- f'<div style="background:#080C14; border-radius:8px; padding:12px; text-align:center;">'
1222
- f'<div style="font-size:10px; color:#4A5568; margin-bottom:4px;">์ „๋ฌธ๊ฐ€ ํ‰๊ท  ๋ชฉํ‘œ๊ฐ€</div>'
1223
  f'<div style="font-size:18px; font-weight:700; color:#4ECDC4; font-family:DM Mono,monospace;">'
1224
  f'{analyst_target_krw:,}์›</div>'
1225
- f'<div style="font-size:11px; color:{"#E53E3E" if an_upside>=0 else "#4299E1"}; margin-top:4px;">'
1226
  f'ํ˜„์žฌ๊ฐ€ ๋Œ€๋น„ {an_upside:+.1f}%</div>'
1227
  f'</div>'
1228
  f'</div>'
@@ -1241,13 +1266,13 @@ def render_scan_report(rpt, analyst_target_krw=0, current_price_krw=0):
1241
  conf_reason = rpt.get("confidence_reason", "")
1242
  catalyst = rpt.get("catalyst", "")
1243
 
1244
- border_color = "#E53E3E" if "๋งค์ˆ˜" in action else ("#4299E1" if "๊ด€๋ง" in action else "rgba(255,255,255,0.08)")
1245
  safe_sum = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(summary).replace('\n',' '))
1246
 
1247
  st.markdown(
1248
  f'<div class="conclusion-box" style="border-left-color:{border_color};">'
1249
- f'<span style="color:#4A5568; font-size:10px; font-weight:700; letter-spacing:2px; text-transform:uppercase;">์ค‘์žฅ๊ธฐ ์Šค์บ” ๋ฆฌํฌํŠธ</span><br><br>'
1250
- f'<span style="color:#8B98B4;">{safe_sum}</span></div>',
1251
  unsafe_allow_html=True
1252
  )
1253
 
@@ -1261,7 +1286,7 @@ def render_scan_report(rpt, analyst_target_krw=0, current_price_krw=0):
1261
  f'border-radius:10px; padding:16px; margin-bottom:14px;">'
1262
  f'<div style="font-size:10px; font-weight:700; color:#C9A84C; letter-spacing:1.5px; '
1263
  f'text-transform:uppercase; margin-bottom:8px;">โšก ์ง€๊ธˆ ํˆฌ์žํ•ด์•ผ ํ•  ์ด‰๋งค</div>'
1264
- f'<div style="font-size:14px; color:#8B98B4; line-height:1.8;">{safe_cat}</div></div>',
1265
  unsafe_allow_html=True
1266
  )
1267
 
@@ -1277,16 +1302,16 @@ def render_scan_report(rpt, analyst_target_krw=0, current_price_krw=0):
1277
  inner = ""
1278
  if safe_q:
1279
  inner += (
1280
- f'<div style="background:rgba(0,0,0,0.2); border-radius:8px; padding:12px; margin-bottom:8px;">'
1281
- f'<div style="font-size:9px; color:#4A5568; margin-bottom:6px; text-transform:uppercase; '
1282
  f'letter-spacing:1.5px;">๐Ÿ“Š ์ •๋Ÿ‰ ๊ทผ๊ฑฐ</div>'
1283
  f'<div class="analysis-content" style="margin:0;">{safe_q}</div>'
1284
  f'</div>'
1285
  )
1286
  if safe_ql:
1287
  inner += (
1288
- f'<div style="background:rgba(0,0,0,0.2); border-radius:8px; padding:12px;">'
1289
- f'<div style="font-size:9px; color:#8B98B4; margin-bottom:6px; text-transform:uppercase; '
1290
  f'letter-spacing:1.5px;">๐Ÿ’ก ์ •์„ฑ ํŒ๋‹จ</div>'
1291
  f'<div class="analysis-content" style="margin:0;">{safe_ql}</div>'
1292
  f'</div>'
@@ -1310,15 +1335,15 @@ def render_scan_report(rpt, analyst_target_krw=0, current_price_krw=0):
1310
  zs = zones.get("stop_thesis", "-")
1311
  zones_html = (
1312
  f'<div style="display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; margin-top:12px;">'
1313
- f'<div style="background:#080C14; border-radius:8px; padding:12px; text-align:center;">'
1314
- f'<div style="font-size:9px; color:#4A5568; margin-bottom:4px; text-transform:uppercase; letter-spacing:1px;">1์ฐจ ๋ถ„ํ• ๋งค์ˆ˜</div>'
1315
- f'<div style="font-size:13px; font-weight:700; color:#4ADE80;">{z1}</div></div>'
1316
- f'<div style="background:#080C14; border-radius:8px; padding:12px; text-align:center;">'
1317
- f'<div style="font-size:9px; color:#4A5568; margin-bottom:4px; text-transform:uppercase; letter-spacing:1px;">2์ฐจ ์ถ”๊ฐ€๋งค์ˆ˜</div>'
1318
- f'<div style="font-size:13px; font-weight:700; color:#EAB308;">{z2}</div></div>'
1319
- f'<div style="background:#080C14; border-radius:8px; padding:12px; text-align:center;">'
1320
- f'<div style="font-size:9px; color:#4A5568; margin-bottom:4px; text-transform:uppercase; letter-spacing:1px;">ํ…Œ์ œ ๋ถ•๊ดด์„ </div>'
1321
- f'<div style="font-size:13px; font-weight:700; color:#E53E3E;">{zs}</div></div>'
1322
  f'</div>'
1323
  )
1324
  st.markdown(
@@ -1345,9 +1370,9 @@ def render_scan_report(rpt, analyst_target_krw=0, current_price_krw=0):
1345
  if hedge:
1346
  safe = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(hedge).replace('\n','<br>'))
1347
  st.markdown(
1348
- f'<div style="background:rgba(66,153,225,0.04); border:1px solid rgba(66,153,225,0.15); '
1349
  f'border-radius:10px; padding:16px; margin-bottom:14px;">'
1350
- f'<div class="analysis-header" style="background:rgba(66,153,225,0.08); color:#4299E1; '
1351
  f'border-color:rgba(66,153,225,0.2);">4์ˆœ์œ„ ยท ๊ธฐ์ˆ ์ฃผ ๋ฆฌ์Šคํฌ ํ—ค์ง€</div>'
1352
  f'<div class="analysis-content">{safe}</div></div>',
1353
  unsafe_allow_html=True
@@ -1369,10 +1394,10 @@ def render_scan_report(rpt, analyst_target_krw=0, current_price_krw=0):
1369
  t = rec.get("ticker","N/A"); n = rec.get("name","Unknown"); r = rec.get("reason","")
1370
  with cols[i % len(cols)]:
1371
  st.markdown(
1372
- f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); border-radius:10px; padding:18px; margin-bottom:10px;">'
1373
- f'<div style="font-size:15px; font-weight:800; color:#EEF2F7; margin-bottom:4px;">{n}</div>'
1374
  f'<div style="font-size:11px; color:#C9A84C; background:rgba(201,168,76,0.1); display:inline-block; padding:2px 8px; border-radius:4px; margin-bottom:10px; border:1px solid rgba(201,168,76,0.2);">{t}</div>'
1375
- f'<div style="font-size:13px; color:#8B98B4; line-height:1.6;">{r}</div></div>',
1376
  unsafe_allow_html=True
1377
  )
1378
  if st.button(f"์Šค์บ” โ€” {t}", key=f"re_scan_btn_{i}_{t}", use_container_width=True):
@@ -1392,17 +1417,17 @@ def render_owned_report(rpt, analyst_target_krw=0, current_price_krw=0):
1392
  conf_reason = rpt.get("confidence_reason", "")
1393
 
1394
  border_color = {
1395
- "๋ณด์œ ": "rgba(255,255,255,0.1)",
1396
- "์ถ”๊ฐ€๋งค์ˆ˜": "#E53E3E",
1397
- "์ต์ ˆ": "#4299E1",
1398
- "์†์ ˆ": "#E53E3E",
1399
- }.get(action, "rgba(255,255,255,0.08)")
1400
 
1401
  safe_sum = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(summary).replace('\n',' '))
1402
  st.markdown(
1403
  f'<div class="conclusion-box" style="border-left-color:{border_color};">'
1404
- f'<span style="color:#4A5568; font-size:10px; font-weight:700; letter-spacing:2px; text-transform:uppercase;">๋ณด์œ  ์ข…๋ชฉ ์ง„๋‹จ ๋ฆฌํฌํŠธ</span><br><br>'
1405
- f'<span style="color:#8B98B4;">{safe_sum}</span></div>',
1406
  unsafe_allow_html=True
1407
  )
1408
 
@@ -1419,21 +1444,21 @@ def render_owned_report(rpt, analyst_target_krw=0, current_price_krw=0):
1419
  no_reason = (not orig or "๋ฏธ๊ธฐ๋ก" in orig or "ํ™•์ธ ๋ถˆ๊ฐ€" in orig)
1420
  if no_reason:
1421
  st.markdown(
1422
- '<div style="background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.08); '
1423
  'border-radius:12px; padding:20px; margin-bottom:14px;">'
1424
  '<div style="display:flex; align-items:center; gap:10px; margin-bottom:12px;">'
1425
  '<div class="analysis-header" style="margin-bottom:0;">1์ˆœ์œ„ ยท ๋งค์ˆ˜ ํ…Œ์ œ ์œ ํšจ์„ฑ</div>'
1426
- '<span style="font-size:12px; font-weight:700; color:#4A5568; '
1427
- 'background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08); '
1428
  'padding:3px 12px; border-radius:20px;">๊ทผ๊ฑฐ ๋ฏธ๊ธฐ๋ก</span>'
1429
  '</div>'
1430
- '<div style="font-size:14px; color:#8B98B4; line-height:1.9; margin-bottom:14px;">'
1431
- '๋งค์ˆ˜ ๋‹น์‹œ ์ƒ๊ฐ์„ ๊ธฐ๋กํ•ด๋‘๋ฉด <b style="color:#EEF2F7;">์ง€๊ธˆ ๊ทธ ์ด์œ ๊ฐ€ ์‚ด์•„์žˆ๋Š”์ง€</b>๋ฅผ '
1432
  '์ •ํ™•ํ•˜๊ฒŒ ํŒ๋‹จํ•ด๋“œ๋ฆด ์ˆ˜ ์žˆ์–ด์š”.<br>'
1433
  '์žฌ๋ฌด ๋ฐ์ดํ„ฐ ๊ธฐ๋ฐ˜ ๋ถ„์„์€ ์•„๋ž˜์—์„œ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์ง€๋งŒ, '
1434
  '"๋‚ด๊ฐ€ ์™œ ์ƒ€๋Š”๊ฐ€"์™€์˜ ๋น„๊ต๋Š” ์ด๋ฒˆ ๋ถ„์„์—์„œ ๋น ์กŒ์Šต๋‹ˆ๋‹ค.'
1435
  '</div>'
1436
- '<div style="font-size:12px; color:#4A5568; '
1437
  'background:rgba(201,168,76,0.04); border:1px solid rgba(201,168,76,0.12); '
1438
  'border-radius:8px; padding:10px 14px;">'
1439
  '๐Ÿ’ก ํฌํŠธํด๋ฆฌ์˜ค ๋ชฉ๋ก์—์„œ <b style="color:#C9A84C;">โœŽ ํŽธ์ง‘</b>์„ ๋ˆŒ๋Ÿฌ ๋งค์ˆ˜ ๊ทผ๊ฑฐ๋ฅผ ์ถ”๊ฐ€ํ•˜๋ฉด, '
@@ -1443,8 +1468,8 @@ def render_owned_report(rpt, analyst_target_krw=0, current_price_krw=0):
1443
  unsafe_allow_html=True
1444
  )
1445
  else:
1446
- verdict_color = {"์œ ํšจ": "#4ADE80", "ํ›ผ์†": "#E53E3E", "์ ๊ฒ€ํ•„์š”": "#EAB308"}.get(verdict, "#8B98B4")
1447
- verdict_bg = {"์œ ํšจ": "rgba(74,222,128,0.08)", "ํ›ผ์†": "rgba(229,62,62,0.08)", "์ ๊ฒ€ํ•„์š”": "rgba(234,179,8,0.08)"}.get(verdict, "rgba(255,255,255,0.04)")
1448
  quant_chk = thesis.get("quantitative_check", "")
1449
  qual_chk = thesis.get("qualitative_check", "")
1450
  safe_curr = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(curr).replace('\n','<br>'))
@@ -1455,26 +1480,26 @@ def render_owned_report(rpt, analyst_target_krw=0, current_price_krw=0):
1455
  check_blocks = ""
1456
  if safe_qn:
1457
  check_blocks += (
1458
- f'<div style="background:rgba(0,0,0,0.2); border-radius:8px; padding:12px; margin-bottom:8px;">'
1459
- f'<div style="font-size:9px; color:#4A5568; margin-bottom:5px; text-transform:uppercase; letter-spacing:1.5px;">๐Ÿ“Š ์ •๋Ÿ‰ ์ ๊ฒ€</div>'
1460
- f'<div style="font-size:13px; color:#8B98B4; line-height:1.7;">{safe_qn}</div>'
1461
  f'</div>'
1462
  )
1463
  if safe_ql:
1464
  check_blocks += (
1465
- f'<div style="background:rgba(0,0,0,0.2); border-radius:8px; padding:12px; margin-bottom:8px;">'
1466
- f'<div style="font-size:9px; color:#8B98B4; margin-bottom:5px; text-transform:uppercase; letter-spacing:1.5px;">๐Ÿ’ก ์ •์„ฑ ์ ๊ฒ€</div>'
1467
- f'<div style="font-size:13px; color:#8B98B4; line-height:1.7;">{safe_ql}</div>'
1468
  f'</div>'
1469
  )
1470
  # ์ •๋Ÿ‰/์ •์„ฑ ์—†์œผ๋ฉด ๊ธฐ์กด current_status ๊ทธ๋Œ€๋กœ (๊ตฌ๋ฒ„์ „ ์บ์‹œ ํ˜ธํ™˜)
1471
  if not check_blocks:
1472
- check_blocks = f'<div style="font-size:14px; color:#8B98B4; line-height:1.8;">{safe_curr}</div>'
1473
  else:
1474
  check_blocks += (
1475
- f'<div style="background:rgba(0,0,0,0.15); border-radius:8px; padding:10px 12px; margin-top:4px;">'
1476
- f'<div style="font-size:9px; color:#4A5568; margin-bottom:4px; text-transform:uppercase; letter-spacing:1.5px;">โš–๏ธ ์ข…ํ•ฉ ํŒ์ •</div>'
1477
- f'<div style="font-size:13px; color:#EEF2F7; line-height:1.7; font-weight:500;">{safe_curr}</div>'
1478
  f'</div>'
1479
  )
1480
 
@@ -1487,9 +1512,9 @@ def render_owned_report(rpt, analyst_target_krw=0, current_price_krw=0):
1487
  f'background:{verdict_bg}; border:1px solid {verdict_color}55; '
1488
  f'padding:3px 12px; border-radius:20px;">{verdict}</span>'
1489
  f'</div>'
1490
- f'<div style="background:rgba(0,0,0,0.2); border-radius:8px; padding:12px; margin-bottom:10px;">'
1491
- f'<div style="font-size:10px; color:#4A5568; margin-bottom:4px; text-transform:uppercase; letter-spacing:1px;">๋งค์ˆ˜ ๋‹น์‹œ ๊ทผ๊ฑฐ</div>'
1492
- f'<div style="font-size:13px; color:#8B98B4;">{orig}</div>'
1493
  f'</div>'
1494
  f'{check_blocks}'
1495
  f'</div>',
@@ -1514,10 +1539,10 @@ def render_owned_report(rpt, analyst_target_krw=0, current_price_krw=0):
1514
  condition = add_buy.get("condition", "")
1515
  forbidden = add_buy.get("forbidden_condition", "")
1516
  sug_price = add_buy.get("suggested_price", "-")
1517
- poss_color = "#4ADE80" if possible else "#E53E3E"
1518
  poss_label = "์ถ”๊ฐ€๋งค์ˆ˜ ๊ฐ€๋Šฅ" if possible else "์ถ”๊ฐ€๋งค์ˆ˜ ์ฃผ์˜"
1519
  st.markdown(
1520
- f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); '
1521
  f'border-radius:10px; padding:16px; margin-bottom:14px;">'
1522
  f'<div style="display:flex; align-items:center; gap:10px; margin-bottom:12px;">'
1523
  f'<div class="analysis-header" style="margin-bottom:0;">3์ˆœ์œ„ ยท ์ถ”๊ฐ€๋งค์ˆ˜ ํŒ๋‹จ</div>'
@@ -1526,17 +1551,17 @@ def render_owned_report(rpt, analyst_target_krw=0, current_price_krw=0):
1526
  f'padding:2px 10px; border-radius:10px;">{poss_label}</span>'
1527
  f'</div>'
1528
  f'<div style="display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:10px;">'
1529
- f'<div style="background:rgba(74,222,128,0.05); border:1px solid rgba(74,222,128,0.15); '
1530
  f'border-radius:8px; padding:10px;">'
1531
- f'<div style="font-size:9px; color:#4ADE80; font-weight:700; margin-bottom:4px; text-transform:uppercase;">๊ฐ€๋Šฅ ์กฐ๊ฑด</div>'
1532
- f'<div style="font-size:12px; color:#8B98B4;">{condition}</div></div>'
1533
- f'<div style="background:rgba(229,62,62,0.05); border:1px solid rgba(229,62,62,0.15); '
1534
  f'border-radius:8px; padding:10px;">'
1535
- f'<div style="font-size:9px; color:#E53E3E; font-weight:700; margin-bottom:4px; text-transform:uppercase;">๊ธˆ์ง€ ์กฐ๊ฑด</div>'
1536
- f'<div style="font-size:12px; color:#8B98B4;">{forbidden}</div></div>'
1537
  f'</div>'
1538
- f'<div style="text-align:center; background:#080C14; border-radius:6px; padding:8px;">'
1539
- f'<span style="font-size:11px; color:#4A5568;">์ถ”๊ฐ€๋งค์ˆ˜ ์ ์ •๊ฐ€</span>'
1540
  f'<span style="font-size:15px; font-weight:700; color:#C9A84C; margin-left:10px; font-family:DM Mono,monospace;">{sug_price}</span>'
1541
  f'</div></div>',
1542
  unsafe_allow_html=True
@@ -1549,20 +1574,20 @@ def render_owned_report(rpt, analyst_target_krw=0, current_price_krw=0):
1549
  upside = target_rem.get("upside_pct", "-")
1550
  exit_s = target_rem.get("exit_strategy", "-")
1551
  st.markdown(
1552
- f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); '
1553
  f'border-radius:10px; padding:16px; margin-bottom:14px;">'
1554
  f'<div class="analysis-header">4์ˆœ์œ„ ยท ๋ชฉํ‘œ๊ฐ€ ์ž”์—ฌ</div>'
1555
  f'<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px;">'
1556
  f'<div>'
1557
- f'<div style="font-size:10px; color:#4A5568; margin-bottom:4px;">๋ชฉํ‘œ๊ฐ€</div>'
1558
  f'<div style="font-size:22px; font-weight:700; color:#C9A84C; font-family:DM Mono,monospace;">{tp}</div>'
1559
  f'</div>'
1560
  f'<div style="text-align:right;">'
1561
- f'<div style="font-size:10px; color:#4A5568; margin-bottom:4px;">์ƒ์Šน ์—ฌ๋ ฅ</div>'
1562
- f'<div style="font-size:22px; font-weight:700; color:#4ADE80; font-family:DM Mono,monospace;">{upside}</div>'
1563
  f'</div></div>'
1564
- f'<div style="background:#080C14; border-radius:6px; padding:10px; font-size:12px; color:#8B98B4;">'
1565
- f'<span style="color:#4A5568; font-weight:700;">๋งค๋„ ์ „๋žต ยท </span>{exit_s}</div>'
1566
  f'</div>',
1567
  unsafe_allow_html=True
1568
  )
@@ -1581,8 +1606,8 @@ def render_portfolio_report(rpt):
1581
  safe_sum = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(summary).replace('\n',' '))
1582
  st.markdown(
1583
  f'<div class="conclusion-box" style="border-left-color:#C9A84C;">'
1584
- f'<span style="color:#4A5568; font-size:10px; font-weight:700; letter-spacing:2px; text-transform:uppercase;">ํฌํŠธํด๋ฆฌ์˜ค ์ข…ํ•ฉ ์ง„๋‹จ</span><br><br>'
1585
- f'<span style="color:#8B98B4;">{safe_sum}</span></div>',
1586
  unsafe_allow_html=True
1587
  )
1588
 
@@ -1594,18 +1619,18 @@ def render_portfolio_report(rpt):
1594
  risk_level = corr.get("risk_level", "๋ณดํ†ต")
1595
  risk_groups = corr.get("risk_groups", [])
1596
  worst = corr.get("worst_scenario", "")
1597
- risk_color = {"๋‚ฎ์Œ":"#4ADE80","๋ณดํ†ต":"#EAB308","๋†’์Œ":"#E53E3E","๋งค์šฐ๋†’์Œ":"#E53E3E"}.get(risk_level, "#EAB308")
1598
 
1599
  groups_html = "".join([
1600
  f'<div style="background:rgba(229,62,62,0.04); border:1px solid rgba(229,62,62,0.12); '
1601
- f'border-radius:6px; padding:8px 12px; margin-bottom:6px; font-size:13px; color:#8B98B4;">'
1602
  f'โš ๏ธ {g}</div>'
1603
  for g in risk_groups
1604
  ])
1605
  safe_worst = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(worst))
1606
 
1607
  st.markdown(
1608
- f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); '
1609
  f'border-radius:12px; padding:20px; margin-bottom:14px;">'
1610
  f'<div style="display:flex; align-items:center; gap:10px; margin-bottom:14px;">'
1611
  f'<div class="analysis-header" style="margin-bottom:0;">1์ˆœ์œ„ ยท ๋™์‹œ ํ•˜๋ฝ ์œ„ํ—˜</div>'
@@ -1614,9 +1639,9 @@ def render_portfolio_report(rpt):
1614
  f'padding:3px 12px; border-radius:20px;">์œ„ํ—˜๋„: {risk_level}</span>'
1615
  f'</div>'
1616
  f'{groups_html}'
1617
- f'<div style="background:rgba(229,62,62,0.06); border-left:3px solid #E53E3E; '
1618
- f'border-radius:0 6px 6px 0; padding:10px 14px; margin-top:10px; font-size:13px; color:#8B98B4;">'
1619
- f'<b style="color:#E53E3E;">์ตœ์•… ์‹œ๋‚˜๋ฆฌ์˜ค ยท </b>{safe_worst}</div>'
1620
  f'</div>',
1621
  unsafe_allow_html=True
1622
  )
@@ -1630,32 +1655,32 @@ def render_portfolio_report(rpt):
1630
 
1631
  sell_html = "".join([
1632
  f'<div style="background:rgba(229,62,62,0.04); border:1px solid rgba(229,62,62,0.12); '
1633
- f'border-radius:6px; padding:8px 12px; margin-bottom:4px; font-size:13px; color:#8B98B4;">'
1634
  f'๐Ÿ“ค {s}</div>'
1635
  for s in sell_list
1636
  ])
1637
  buy_html = "".join([
1638
  f'<div style="background:rgba(74,222,128,0.04); border:1px solid rgba(74,222,128,0.12); '
1639
- f'border-radius:6px; padding:8px 12px; margin-bottom:4px; font-size:13px; color:#8B98B4;">'
1640
  f'๐Ÿ“ฅ {b}</div>'
1641
  for b in buy_list
1642
  ])
1643
 
1644
  st.markdown(
1645
- f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); '
1646
  f'border-radius:12px; padding:20px; margin-bottom:14px;">'
1647
  f'<div class="analysis-header">2์ˆœ์œ„ ยท ๋ฆฌ๋ฐธ๋Ÿฐ์‹ฑ ์šฐ์„ ์ˆœ์œ„</div>'
1648
  f'<div style="display:grid; grid-template-columns:1fr 1fr; gap:12px;">'
1649
  f'<div>'
1650
- f'<div style="font-size:10px; color:#E53E3E; font-weight:700; margin-bottom:8px; text-transform:uppercase; letter-spacing:1px;">๋จผ์ € ๋งค๋„</div>'
1651
- f'{sell_html if sell_html else "<div style=\'font-size:13px;color:#4A5568;\'>ํ•ด๋‹น ์—†์Œ</div>"}'
1652
  f'</div>'
1653
  f'<div>'
1654
- f'<div style="font-size:10px; color:#4ADE80; font-weight:700; margin-bottom:8px; text-transform:uppercase; letter-spacing:1px;">์ถ”๊ฐ€ ๋งค์ˆ˜</div>'
1655
- f'{buy_html if buy_html else "<div style=\'font-size:13px;color:#4A5568;\'>ํ•ด๋‹น ์—†์Œ</div>"}'
1656
  f'</div>'
1657
  f'</div>'
1658
- f'{"<div style=\'background:rgba(66,153,225,0.06);border:1px solid rgba(66,153,225,0.15);border-radius:8px;padding:10px 14px;margin-top:12px;font-size:13px;color:#8B98B4;\'><b style=\'color:#4299E1;\'>ํ—ค์ง€ ์ถ”์ฒœ ยท </b>" + hedge_s + "</div>" if hedge_s else ""}'
1659
  f'</div>',
1660
  unsafe_allow_html=True
1661
  )
@@ -1667,19 +1692,19 @@ def render_portfolio_report(rpt):
1667
  base = outlook.get("base", "-")
1668
  pess = outlook.get("pessimistic", "-")
1669
  st.markdown(
1670
- f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); '
1671
  f'border-radius:10px; padding:16px; margin-bottom:14px;">'
1672
  f'<div class="analysis-header">3์ˆœ์œ„ ยท 6๊ฐœ์›” ์ˆ˜์ต๋ฅ  ์ „๋ง</div>'
1673
  f'<div style="display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px;">'
1674
  f'<div style="background:rgba(74,222,128,0.06); border:1px solid rgba(74,222,128,0.15); border-radius:8px; padding:12px; text-align:center;">'
1675
- f'<div style="font-size:9px; color:#4ADE80; font-weight:700; margin-bottom:6px; text-transform:uppercase;">๋‚™๊ด€</div>'
1676
- f'<div style="font-size:15px; font-weight:700; color:#4ADE80; font-family:DM Mono,monospace;">{opt}</div></div>'
1677
  f'<div style="background:rgba(234,179,8,0.06); border:1px solid rgba(234,179,8,0.15); border-radius:8px; padding:12px; text-align:center;">'
1678
- f'<div style="font-size:9px; color:#EAB308; font-weight:700; margin-bottom:6px; text-transform:uppercase;">๊ธฐ๋ณธ</div>'
1679
- f'<div style="font-size:15px; font-weight:700; color:#EAB308; font-family:DM Mono,monospace;">{base}</div></div>'
1680
  f'<div style="background:rgba(229,62,62,0.06); border:1px solid rgba(229,62,62,0.15); border-radius:8px; padding:12px; text-align:center;">'
1681
- f'<div style="font-size:9px; color:#E53E3E; font-weight:700; margin-bottom:6px; text-transform:uppercase;">๋น„๊ด€</div>'
1682
- f'<div style="font-size:15px; font-weight:700; color:#E53E3E; font-family:DM Mono,monospace;">{pess}</div></div>'
1683
  f'</div></div>',
1684
  unsafe_allow_html=True
1685
  )
@@ -1692,42 +1717,42 @@ def render_portfolio_report(rpt):
1692
  gvt = conc.get("growth_vs_turnaround", "")
1693
  qn_conc = conc.get("quantitative_concentration", "")
1694
  ql_conc = conc.get("qualitative_concentration", "")
1695
- tech_color = "#E53E3E" if tech_w >= 70 else ("#EAB308" if tech_w >= 50 else "#4ADE80")
1696
 
1697
  conc_detail = ""
1698
  if qn_conc:
1699
  safe_qn = qn_conc.replace("\n","<br>")
1700
  conc_detail += (
1701
- f'<div style="background:rgba(0,0,0,0.2); border-radius:8px; padding:10px 12px; margin-bottom:8px;">'
1702
- f'<div style="font-size:9px; color:#4A5568; margin-bottom:5px; text-transform:uppercase; letter-spacing:1.5px;">๐Ÿ“Š ์ •๋Ÿ‰ ์ง‘์ค‘๋„</div>'
1703
- f'<div style="font-size:13px; color:#8B98B4; line-height:1.7;">{safe_qn}</div>'
1704
  f'</div>'
1705
  )
1706
  if ql_conc:
1707
  safe_ql = ql_conc.replace("\n","<br>")
1708
  conc_detail += (
1709
- f'<div style="background:rgba(0,0,0,0.2); border-radius:8px; padding:10px 12px; margin-bottom:8px;">'
1710
- f'<div style="font-size:9px; color:#8B98B4; margin-bottom:5px; text-transform:uppercase; letter-spacing:1.5px;">๐Ÿ’ก ์ •์„ฑ ์ง‘์ค‘๋„ (ํ…Œ๋งˆ ์ค‘๋ณต)</div>'
1711
- f'<div style="font-size:13px; color:#8B98B4; line-height:1.7;">{safe_ql}</div>'
1712
  f'</div>'
1713
  )
1714
  if not conc_detail and warn_m:
1715
- conc_detail = f'<div style="font-size:13px; color:#8B98B4; margin-bottom:8px;">{warn_m}</div>'
1716
 
1717
  st.markdown(
1718
- f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); '
1719
  f'border-radius:10px; padding:16px; margin-bottom:14px;">'
1720
  f'<div class="analysis-header">4์ˆœ์œ„ ยท ์ง‘์ค‘๋„ ๊ฒฝ๊ณ </div>'
1721
  f'<div style="display:flex; align-items:center; gap:16px; margin-bottom:12px;">'
1722
  f'<div>'
1723
- f'<div style="font-size:10px; color:#4A5568; margin-bottom:2px;">๊ธฐ์ˆ ์ฃผ ๋น„์ค‘</div>'
1724
  f'<div style="font-size:28px; font-weight:900; color:{tech_color}; font-family:DM Mono,monospace;">{tech_w}%</div>'
1725
  f'</div>'
1726
- f'<div style="background:rgba(255,255,255,0.04); border-radius:6px; height:8px; flex:1;">'
1727
  f'<div style="background:{tech_color}; width:{min(tech_w,100)}%; height:8px; border-radius:6px;"></div>'
1728
  f'</div></div>'
1729
  f'{conc_detail}'
1730
- f'{"<div style='background:#080C14;border-radius:6px;padding:8px 12px;font-size:12px;color:#8B98B4;'><b style='color:#4A5568;'>์„ฑ์žฅ์ฃผ vs ํ„ด์–ด๋ผ์šด๋“œ ยท </b>" + gvt + "</div>" if gvt else ""}'
1731
  f'</div>',
1732
  unsafe_allow_html=True
1733
  )
@@ -1742,10 +1767,10 @@ def render_portfolio_report(rpt):
1742
  t = rec.get("ticker","N/A"); n = rec.get("name","Unknown"); r = rec.get("reason","")
1743
  with cols[i % len(cols)]:
1744
  st.markdown(
1745
- f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); border-radius:10px; padding:18px; margin-bottom:10px;">'
1746
- f'<div style="font-size:15px; font-weight:800; color:#EEF2F7; margin-bottom:4px;">{n}</div>'
1747
  f'<div style="font-size:11px; color:#C9A84C; background:rgba(201,168,76,0.1); display:inline-block; padding:2px 8px; border-radius:4px; margin-bottom:10px; border:1px solid rgba(201,168,76,0.2);">{t}</div>'
1748
- f'<div style="font-size:13px; color:#8B98B4; line-height:1.6;">{r}</div></div>',
1749
  unsafe_allow_html=True
1750
  )
1751
  if st.button(f"์Šค์บ” โ€” {t}", key=f"port_rec_btn_{i}_{t}", use_container_width=True):
@@ -1768,13 +1793,13 @@ def draw_chart(ticker):
1768
  fig = go.Figure(go.Candlestick(
1769
  x=hist.index, open=hist['Open'], high=hist['High'],
1770
  low=hist['Low'], close=hist['Close'],
1771
- increasing_line_color='#E53E3E', decreasing_line_color='#4299E1'
1772
  ))
1773
  fig.update_layout(
1774
  height=240, margin=dict(l=0,r=0,t=0,b=0),
1775
  paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0)',
1776
  xaxis=dict(showgrid=False, visible=False, rangeslider=dict(visible=False)),
1777
- yaxis=dict(showgrid=True, gridcolor='rgba(255,255,255,0.04)', visible=False),
1778
  hovermode="x unified"
1779
  )
1780
  st.plotly_chart(fig, use_container_width=True, config={'displayModeBar':False})
@@ -1782,13 +1807,13 @@ def draw_chart(ticker):
1782
  fig2 = go.Figure(go.Scatter(
1783
  x=hist.index, y=hist['Close'], fill='tozeroy', mode='lines',
1784
  line=dict(color='#C9A84C', width=2),
1785
- fillcolor='rgba(201,168,76,0.06)'
1786
  ))
1787
  fig2.update_layout(
1788
  height=240, margin=dict(l=0,r=0,t=0,b=0),
1789
  paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0)',
1790
  xaxis=dict(showgrid=False, visible=False),
1791
- yaxis=dict(showgrid=True, gridcolor='rgba(255,255,255,0.04)', visible=False),
1792
  hovermode="x unified"
1793
  )
1794
  st.plotly_chart(fig2, use_container_width=True, config={'displayModeBar':False})
@@ -1857,10 +1882,10 @@ def get_price_alert(action, current_price, target_price_str, avg_price, report=N
1857
  def render_price_alert(level, message, ticker, name):
1858
  if level is None: return
1859
  cfg = {
1860
- 'tp_hit': ("#4299E1", "rgba(66,153,225,0.08)", "rgba(66,153,225,0.25)", "์ต์ ˆ ๋ชฉํ‘œ ๋„๋‹ฌ"),
1861
- 'tp': ("#4299E1", "rgba(66,153,225,0.06)", "rgba(66,153,225,0.18)", "์ต์ ˆ ์ž„๋ฐ•"),
1862
- 'sl': ("#E53E3E", "rgba(229,62,62,0.06)", "rgba(229,62,62,0.2)", "์†์ ˆ ์ฃผ์˜"),
1863
- 'sl_broken': ("#E53E3E", "rgba(229,62,62,0.1)", "rgba(229,62,62,0.35)", "์†์ ˆ๊ฐ€ ์ดํƒˆ"),
1864
  }
1865
  color, bg, border, label = cfg.get(level, ("#C9A84C","rgba(201,168,76,0.06)","rgba(201,168,76,0.2)","์•Œ๋ฆผ"))
1866
  pulse = "animation:alertPulse 1.8s ease-in-out infinite;" if "broken" in level or "hit" in level else ""
@@ -1890,7 +1915,7 @@ def render_stock_header(name, ticker, price, stars, mode_label, has_rich):
1890
  f'<span class="stock-name">{name}</span>'
1891
  f'<span class="stock-ticker">{ticker}</span></div>'
1892
  f'<div class="price-star-row">'
1893
- f'<span class="stock-price">{price:,}<span style="font-size:16px;color:#4A5568;margin-left:4px;">์›</span></span>'
1894
  f'<div class="star-rating">{stars}</div></div></div>',
1895
  unsafe_allow_html=True
1896
  )
@@ -1909,10 +1934,10 @@ def render_trade_analytics(tdf):
1909
  st.markdown("### ๋งค๋งค ์„ฑ๊ณผ ๋ถ„์„")
1910
  c1, c2, c3, c4 = st.columns(4)
1911
  for col, label, val, color in [
1912
- (c1, "์ด ๋ˆ„์  ์‹คํ˜„์†์ต", f"{int(total):,}์›", "#E53E3E" if total>=0 else "#4299E1"),
1913
- (c2, "์Šน๋ฅ ", f"{wr:.1f}%", "#4ADE80" if wr>=bew else "#E53E3E"),
1914
- (c3, "์†์ต๋น„ (R)", f"{rr:.2f}", "#4ADE80" if rr>=1.5 else "#EAB308"),
1915
- (c4, "์ด ๋งค๋งค ํšŸ์ˆ˜", f"{len(tdf)}ํšŒ", "#EEF2F7"),
1916
  ]:
1917
  with col:
1918
  st.markdown(
@@ -1923,24 +1948,24 @@ def render_trade_analytics(tdf):
1923
  )
1924
 
1925
  r_msg = "์šฐ์ˆ˜ (1.5โ†‘)" if rr>=1.5 else ("์–‘ํ˜ธ (1.0โ†‘)" if rr>=1.0 else "๊ฐœ์„  ํ•„์š”")
1926
- r_color = "#4ADE80" if rr>=1.5 else ("#EAB308" if rr>=1.0 else "#E53E3E")
1927
  st.markdown(
1928
- f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); border-radius:8px; '
1929
- f'padding:14px 16px; margin-top:14px; font-size:13px; color:#8B98B4;">'
1930
  f'<b style="color:{r_color};">์†์ต๋น„: {r_msg}</b> &nbsp;|&nbsp; '
1931
- f'<span style="color:#4A5568;">์†์ต๋ถ„๊ธฐ ์Šน๋ฅ : {bew:.1f}% (ํ˜„์žฌ: {wr:.1f}%)</span></div>',
1932
  unsafe_allow_html=True
1933
  )
1934
  st.markdown("#### ์ „๋žต ํƒœ๊ทธ๋ณ„ ์„ฑ๊ณผ")
1935
  ts = tdf.groupby('ํƒœ๊ทธ')['์‹คํ˜„์†์ต'].agg(ํšŸ์ˆ˜='count', ํ•ฉ๊ณ„='sum').reset_index().sort_values('ํ•ฉ๊ณ„', ascending=False)
1936
  for _, row in ts.iterrows():
1937
- c = "#E53E3E" if row['ํ•ฉ๊ณ„'] >= 0 else "#4299E1"
1938
  st.markdown(
1939
  f'<div style="display:flex; justify-content:space-between; align-items:center; '
1940
- f'background:#0F1623; border:1px solid rgba(255,255,255,0.07); border-radius:8px; '
1941
  f'padding:12px 16px; margin-bottom:6px;">'
1942
- f'<span style="font-weight:700; color:#EEF2F7;">{row["ํƒœ๊ทธ"]}</span>'
1943
- f'<span style="font-size:12px; color:#4A5568;">{int(row["ํšŸ์ˆ˜"])}ํšŒ</span>'
1944
  f'<span style="font-weight:700; color:{c}; font-family:DM Mono,monospace;">{int(row["ํ•ฉ๊ณ„"]):+,}์›</span></div>',
1945
  unsafe_allow_html=True
1946
  )
@@ -2091,10 +2116,10 @@ def render_grouped_alert_panel(prices, rate):
2091
  '@keyframes alItemIn{{from{{transform:translateX(12px);opacity:0}}to{{transform:translateX(0);opacity:1}}}}' +
2092
  '#' + PID + ' *{{box-sizing:border-box;font-family:"JetBrains Mono","Noto Sans KR",monospace;}}' +
2093
  '#' + PID + ' ::-webkit-scrollbar{{width:4px}}' +
2094
- '#' + PID + ' ::-webkit-scrollbar-thumb{{background:rgba(255,255,255,0.1);border-radius:2px}}' +
2095
- '#' + PID + ' .al-item:hover{{background:rgba(255,255,255,0.06)!important;transform:translateX(-2px)}}' +
2096
  '#' + PID + ' .al-tab:hover{{opacity:1!important}}' +
2097
- '#' + PID + ' .al-minbtn:hover{{background:rgba(255,255,255,0.1)!important}}';
2098
  pdoc.head.appendChild(st);
2099
  }}
2100
  function hideAlertBtn() {{
@@ -2268,7 +2293,7 @@ def render_grouped_alert_panel(prices, rate):
2268
  root.innerHTML =
2269
  '<div style="width:360px;animation:alSlideUp 0.4s cubic-bezier(0.34,1.56,0.64,1);">' +
2270
  '<div style="background:linear-gradient(135deg,#1e2435,#161c2a);' +
2271
- 'border-radius:16px 16px 0 0;border:1px solid rgba(255,255,255,0.08);' +
2272
  'border-bottom:none;padding:14px 16px 0;">' +
2273
  '<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;">' +
2274
  '<div style="display:flex;align-items:center;gap:8px;">' +
@@ -2279,7 +2304,7 @@ def render_grouped_alert_panel(prices, rate):
2279
  'border-radius:6px;padding:1px 7px;font-size:11px;color:#FF4757;font-weight:700;">' + cnt + '</span>' +
2280
  '</div>' +
2281
  '<div style="display:flex;align-items:center;gap:6px;">' +
2282
- '<div style="background:rgba(255,255,255,0.05);border-radius:8px;padding:4px 9px;">' +
2283
  '<span id="al-timer-span" style="font-size:11px;color:' + (tl > 20 ? 'rgba(255,255,255,0.4)' : '#FF4757') + ';font-weight:600;">' + tl + 's</span>' +
2284
  '</div>' +
2285
  '<button id="al-minbtn" class="al-minbtn" style="background:transparent;border:none;cursor:pointer;' +
@@ -2290,7 +2315,7 @@ def render_grouped_alert_panel(prices, rate):
2290
  '<div style="display:flex;gap:4px;">' + tabHtml + '</div>' +
2291
  '</div>' +
2292
  '<div style="background:linear-gradient(180deg,#161c2a,#131820);' +
2293
- 'border:1px solid rgba(255,255,255,0.08);border-top:2px solid ' + cfg.accent + ';' +
2294
  'border-radius:0 0 16px 16px;max-height:300px;overflow-y:auto;padding:8px;">' +
2295
  itemHtml +
2296
  '</div>' +
@@ -2377,8 +2402,8 @@ elif st.session_state.main_menu == "โŒ‚ ํ™ˆ & ์Šค์บ”":
2377
 
2378
  if st.session_state.df.empty:
2379
  st.markdown("""
2380
- <div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); border-radius:14px; padding:28px; margin-bottom:20px;">
2381
- <h3 style="color:#EEF2F7; margin-bottom:18px; font-size:18px;">Invest Pro Alpha์— ์˜ค์‹  ๊ฑธ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค</h3>
2382
  <div class="onboarding-step"><b style="color:#C9A84C;">Step 1.</b> ์ž์‚ฐ ์ƒ์„ธ ์ง„๋‹จ โ†’ ๋ณด์œ  ์ข…๋ชฉ ์ถ”๊ฐ€</div>
2383
  <div class="onboarding-step"><b style="color:#C9A84C;">Step 2.</b> AI ์Šค์บ”์œผ๋กœ ์ค‘์žฅ๊ธฐ ์„ฑ์žฅ์ฃผ ๋ถ„์„</div>
2384
  <div class="onboarding-step"><b style="color:#C9A84C;">Step 3.</b> ๋งค๋งค ์ผ์ง€๋กœ ์Šน๋ฅ ยท์†์ต๋น„ ๋ฐ์ดํ„ฐ ์Œ“๊ธฐ</div>
@@ -2391,11 +2416,11 @@ elif st.session_state.main_menu == "โŒ‚ ํ™ˆ & ์Šค์บ”":
2391
  with st.spinner("ํฌํŠธํด๋ฆฌ์˜ค ๋ถ„์„ ์ค‘..."):
2392
  msg = get_ai_alert(", ".join(port_ai), _key_hash(), st.session_state.selected_model)
2393
  st.markdown(
2394
- f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); '
2395
  f'border-left:3px solid #C9A84C; '
2396
  f'padding:14px 16px; border-radius:8px; margin-bottom:16px;">'
2397
  f'<div style="font-size:10px; font-weight:700; color:#C9A84C; margin-bottom:6px; letter-spacing:2px; text-transform:uppercase;">AI PORTFOLIO BRIEFING</div>'
2398
- f'<span style="font-size:13px; color:#8B98B4; line-height:1.7;">{msg}</span></div>',
2399
  unsafe_allow_html=True
2400
  )
2401
 
@@ -2480,8 +2505,8 @@ elif st.session_state.main_menu == "โŒ‚ ํ™ˆ & ์Šค์บ”":
2480
  tp = get_analyst_target(tn)
2481
  if tp > 0:
2482
  st.markdown(
2483
- f"<div style='text-align:right; font-size:13px; color:#4A5568; margin-top:-12px; margin-bottom:14px;'>"
2484
- f"์ „๋ฌธ๊ฐ€ ํ‰๊ท  ๋ชฉํ‘œ๊ฐ€ <b style='color:#8B98B4;'>{tp:,}์›</b></div>",
2485
  unsafe_allow_html=True
2486
  )
2487
  draw_chart(tn)
@@ -2562,8 +2587,8 @@ elif st.session_state.main_menu == "โ–ค ์ž์‚ฐ ์ƒ์„ธ ์ง„๋‹จ":
2562
  'border-radius:10px; padding:16px 18px; margin-bottom:14px;">'
2563
  '<div style="font-size:11px; font-weight:700; color:#C9A84C; letter-spacing:1.5px; '
2564
  'text-transform:uppercase; margin-bottom:8px;">โœ๏ธ ๋งค์ˆ˜ ๊ทผ๊ฑฐ ๋ฏธ๊ธฐ๋ก</div>'
2565
- '<div style="font-size:13px; color:#8B98B4; line-height:1.8; margin-bottom:12px;">'
2566
- '๋งค์ˆ˜ ๋‹น์‹œ ์ƒ๊ฐ์„ ์ ์–ด๋‘๋ฉด <b style="color:#EEF2F7;">ํ…Œ์ œ ์œ ํšจ์„ฑ</b>์„ ์ •ํ™•ํ•˜๊ฒŒ ํŒ๋‹จํ•  ์ˆ˜ ์žˆ์–ด์š”.<br>'
2567
  '์ง€๊ธˆ ์ž…๋ ฅํ•˜์ง€ ์•Š์•„๋„ ๋ถ„์„์€ ๋ฐ”๋กœ ์ง„ํ–‰๋˜์ง€๋งŒ, ๊ธฐ๋ก์ด ์—†์œผ๋ฉด "์™œ ์ƒ€๋Š”๊ฐ€" ๋น„๊ต๊ฐ€ ๋น ์ง‘๋‹ˆ๋‹ค.'
2568
  '</div>'
2569
  '</div>',
@@ -2618,13 +2643,13 @@ elif st.session_state.main_menu == "โ–ค ์ž์‚ฐ ์ƒ์„ธ ์ง„๋‹จ":
2618
  render_stock_header(n, dt, p, stars, "๋ณด์œ  ์ข…๋ชฉ ์ง„๋‹จ ๋ฆฌํฌํŠธ", has_rich)
2619
 
2620
  # ๋ณด์œ  ๊ธฐ๊ฐ„ & ์ˆ˜์ต๋ฅ  ๋ฐฐ์ง€
2621
- p_color = "#E53E3E" if p_pct >= 0 else "#4299E1"
2622
  p_arrow = "โ–ฒ" if p_pct >= 0 else "โ–ผ"
2623
  st.markdown(
2624
  f'<div style="display:flex; gap:8px; margin-top:-12px; margin-bottom:14px; flex-wrap:wrap;">'
2625
- f'<span style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); border-radius:6px; '
2626
- f'padding:4px 10px; font-size:12px; color:#4A5568;">๋ณด์œ  {holding_days}</span>'
2627
- f'<span style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); border-radius:6px; '
2628
  f'padding:4px 10px; font-size:12px; color:{p_color}; font-weight:700;">'
2629
  f'{p_arrow} {abs(p_pct):.2f}%</span>'
2630
  f'</div>',
@@ -2634,8 +2659,8 @@ elif st.session_state.main_menu == "โ–ค ์ž์‚ฐ ์ƒ์„ธ ์ง„๋‹จ":
2634
  tp = get_analyst_target(dt)
2635
  if tp > 0:
2636
  st.markdown(
2637
- f"<div style='text-align:right; font-size:13px; color:#4A5568; margin-top:-8px; margin-bottom:14px;'>"
2638
- f"์ „๋ฌธ๊ฐ€ ํ‰๊ท  ๋ชฉํ‘œ๊ฐ€ <b style='color:#8B98B4;'>{tp:,}์›</b></div>",
2639
  unsafe_allow_html=True
2640
  )
2641
  draw_chart(dt)
@@ -2699,12 +2724,12 @@ elif st.session_state.main_menu == "โ–ค ์ž์‚ฐ ์ƒ์„ธ ์ง„๋‹จ":
2699
  dv['์ˆ˜์ต๋ฅ '] = dv.apply(lambda r: ((r['ํ˜„์žฌ๊ฐ€']/r['ํ‰๋‹จ๊ฐ€'])-1)*100 if r['ํ‰๋‹จ๊ฐ€']>0 else 0, axis=1)
2700
  fig = px.treemap(
2701
  dv, path=['์ข…๋ชฉ๋ช…'], values='ํ‰๊ฐ€์•ก', color='์ˆ˜์ต๋ฅ ',
2702
- color_continuous_scale=['#4299E1','#161E2E','#E53E3E'],
2703
  color_continuous_midpoint=0, custom_data=['์ˆ˜์ต๋ฅ ','ํ˜„์žฌ๊ฐ€','ํ‹ฐ์ปค']
2704
  )
2705
  fig.update_traces(
2706
- textfont=dict(family="Noto Sans KR", size=14, color="#EEF2F7"),
2707
- marker=dict(line=dict(color='#080C14', width=3)),
2708
  texttemplate="<b>%{label}</b><br><span style='font-size:12px;'>%{customdata[0]:.1f}%</span>",
2709
  hovertemplate='<b>%{label} (%{customdata[2]})</b><br>ํ‰๊ฐ€์•ก: %{value:,.0f}์›<br>์ˆ˜์ต๋ฅ : %{customdata[0]:.2f}%<extra></extra>'
2710
  )
@@ -2875,10 +2900,10 @@ elif st.session_state.main_menu == "โ–ค ์ž์‚ฐ ์ƒ์„ธ ์ง„๋‹จ":
2875
  st.markdown('<div class="portfolio-item-row-marker"></div>', unsafe_allow_html=True)
2876
  ct, cl2, ce, cd = st.columns([0.7,0.1,0.1,0.1], vertical_alignment="center")
2877
  with ct:
2878
- tv_color = {"์œ ํšจ":"#4ADE80","ํ›ผ์†":"#E53E3E","์ ๊ฒ€ํ•„์š”":"#EAB308"}.get(tv, "#4A5568")
2879
  tv_html = f'<span style="font-size:9px; color:{tv_color}; background:{tv_color}15; border:1px solid {tv_color}44; padding:1px 6px; border-radius:3px; margin-left:6px;">{tv}</span>' if tv else ""
2880
  st.markdown(
2881
- f'<div style="font-size:16px; font-weight:800; color:#EEF2F7;">'
2882
  f'{row["์ข…๋ชฉ๋ช…"]} '
2883
  f'<span style="font-size:11px; color:#C9A84C; background:rgba(201,168,76,0.1); '
2884
  f'padding:2px 6px; border-radius:4px; border:1px solid rgba(201,168,76,0.2);">{t}</span>'
@@ -2899,19 +2924,19 @@ elif st.session_state.main_menu == "โ–ค ์ž์‚ฐ ์ƒ์„ธ ์ง„๋‹จ":
2899
  st.session_state.df = st.session_state.df.drop(idx).reset_index(drop=True)
2900
  save_assets(); st.session_state.price_cache_ts=0; st.rerun()
2901
 
2902
- pc = "#E53E3E" if pct>=0 else "#4299E1"
2903
  pa = "โ–ฒ" if pct>=0 else "โ–ผ"
2904
  st.markdown(
2905
- f'<div style="font-size:13px; color:#8B98B4; margin-top:8px; margin-bottom:10px;">'
2906
- f'ํ‰๋‹จ <b style="color:#EEF2F7; font-family:DM Mono,monospace;">{int(ap):,}</b>์› &nbsp;ยท&nbsp; '
2907
- f'ํ˜„์žฌ <b style="color:#EEF2F7; font-family:DM Mono,monospace;">{ck:,}</b>์› &nbsp;ยท&nbsp; '
2908
  f'<span style="color:{pc}; font-weight:700; font-family:DM Mono,monospace;">{pa} {abs(pct):.2f}%</span></div>',
2909
  unsafe_allow_html=True
2910
  )
2911
  st.markdown(
2912
- f'<div style="background:#080C14; border:1px solid rgba(255,255,255,0.06); border-radius:6px; '
2913
- f'padding:10px 14px; font-size:13px; color:#8B98B4; margin-bottom:10px;">'
2914
- f'์ „๋žต <span style="color:#EEF2F7; font-weight:700;">[{act}]</span>'
2915
  f' &nbsp;ยท&nbsp; ๋ชฉํ‘œ๊ฐ€ <span style="color:#C9A84C;">{tgp}</span></div>',
2916
  unsafe_allow_html=True
2917
  )
@@ -2922,7 +2947,7 @@ elif st.session_state.main_menu == "โ–ค ์ž์‚ฐ ์ƒ์„ธ ์ง„๋‹จ":
2922
  st.markdown(
2923
  f'<div style="background:rgba(201,168,76,0.05); border:1px solid rgba(201,168,76,0.15); '
2924
  f'border-left:3px solid rgba(201,168,76,0.4); border-radius:6px; '
2925
- f'padding:10px 14px; font-size:13px; color:#8B98B4; margin-bottom:10px;">'
2926
  f'<span style="font-size:10px; color:#C9A84C; font-weight:700; letter-spacing:1px; '
2927
  f'text-transform:uppercase; display:block; margin-bottom:5px;">'
2928
  f'๋งค์ˆ˜ ๊ทผ๊ฑฐ{(" ยท " + buy_date) if buy_date else ""}</span>'
@@ -2938,7 +2963,7 @@ elif st.session_state.main_menu == "โ–ค ์ž์‚ฐ ์ƒ์„ธ ์ง„๋‹จ":
2938
 
2939
  if st.session_state.get(f"log_mode_{idx}", False):
2940
  st.markdown('<div class="inline-edit-box" style="border-color:rgba(66,153,225,0.2);">', unsafe_allow_html=True)
2941
- st.markdown(f'<b style="color:#EEF2F7; font-size:14px;">{row["์ข…๋ชฉ๋ช…"]} ๋งค๋งค ๋ณต๊ธฐ</b>', unsafe_allow_html=True)
2942
  lc1, lc2 = st.columns(2)
2943
  with lc1: sp = st.number_input("๋งค๋„ ๋‹จ๊ฐ€(์›)", value=float(ck), step=100.0, key=f"sp_{idx}")
2944
  with lc2: sq = st.number_input("๋งค๋„ ์ˆ˜๋Ÿ‰", value=float(row['์ˆ˜๋Ÿ‰']), max_value=float(row['์ˆ˜๋Ÿ‰']), min_value=0.01, step=1.0, key=f"sq_{idx}")
@@ -2997,27 +3022,27 @@ elif st.session_state.main_menu == "๐Ÿ“– ๋‚˜์˜ ๋งค๋งค ์ผ์ง€":
2997
  st.markdown("### ๋งค๋งค ๊ธฐ๋ก")
2998
  for _, log in st.session_state.trade_df.iterrows():
2999
  ip = log['์‹คํ˜„์†์ต'] >= 0
3000
- pnl_color = "#E53E3E" if ip else "#4299E1"
3001
  log_reason = str(log.get('๋งค์ˆ˜๊ทผ๊ฑฐ', '') or '').strip()
3002
  reason_html = (
3003
  f'<div style="background:rgba(201,168,76,0.05); border:1px solid rgba(201,168,76,0.12); '
3004
- f'border-radius:5px; padding:8px 12px; font-size:12px; color:#8B98B4; margin-top:8px;">'
3005
  f'<span style="color:#C9A84C; font-weight:700; font-size:10px; letter-spacing:1px; '
3006
  f'text-transform:uppercase;">๋งค์ˆ˜ ๊ทผ๊ฑฐ</span> &nbsp;{log_reason}</div>'
3007
  ) if log_reason else ''
3008
  st.markdown(
3009
- f'<div style="background:#0F1623; border:1px solid rgba(255,255,255,0.07); '
3010
  f'padding:16px; border-radius:10px; margin-bottom:8px;">'
3011
  f'<div style="display:flex; justify-content:space-between; align-items:baseline; margin-bottom:8px;">'
3012
  f'<div>'
3013
- f'<span style="font-size:15px; font-weight:800; color:#EEF2F7;">{log["์ข…๋ชฉ๋ช…"]}</span>'
3014
- f'<span style="font-size:11px; color:#4A5568; margin-left:8px; font-family:DM Mono,monospace;">{log["์ผ์‹œ"]}</span>'
3015
  f'</div>'
3016
  f'<div style="font-weight:700; color:{pnl_color}; font-family:DM Mono,monospace;">'
3017
  f'{("+" if ip else "")}{int(log["์‹คํ˜„์†์ต"]):,}์›</div></div>'
3018
- f'<div style="font-size:13px; color:#8B98B4; margin-bottom:8px; font-family:DM Mono,monospace;">'
3019
  f'{log["๊ตฌ๋ถ„"]}๊ฐ€ {int(log["๋งค๋งค๊ฐ€"]):,}์› ยท {log["์ˆ˜๋Ÿ‰"]}์ฃผ</div>'
3020
- f'<div style="background:#080C14; padding:10px 12px; border-radius:6px; font-size:13px; color:#8B98B4;">'
3021
  f'<span style="color:#C9A84C; font-weight:700;">{log["ํƒœ๊ทธ"]}</span>'
3022
  f'<span style="margin-left:8px;">{log["๋ฉ”๋ชจ"]}</span></div>'
3023
  f'{reason_html}</div>',
@@ -3027,7 +3052,7 @@ elif st.session_state.main_menu == "๐Ÿ“– ๋‚˜์˜ ๋งค๋งค ์ผ์ง€":
3027
  elif st.session_state.main_menu == "โ˜… ๊ด€์‹ฌ ์ข…๋ชฉ":
3028
  st.markdown("### ๊ด€์‹ฌ ์ข…๋ชฉ")
3029
  st.markdown(
3030
- '<p style="font-size:13px; color:#4A5568; margin-bottom:16px;">์Šค์บ” ๋˜๋Š” ์ž์‚ฐ ์ƒ์„ธ์—์„œ ๊ด€์‹ฌ์ข…๋ชฉ์œผ๋กœ ์ถ”๊ฐ€ํ•œ ์ข…๋ชฉ์ž…๋‹ˆ๋‹ค.</p>',
3031
  unsafe_allow_html=True
3032
  )
3033
  st.divider()
@@ -3050,15 +3075,15 @@ elif st.session_state.main_menu == "โ˜… ๊ด€์‹ฌ ์ข…๋ชฉ":
3050
  elif st.session_state.main_menu == "โš™ ์‹œ์Šคํ…œ ์„ค์ •":
3051
  st.markdown("### ์‹œ์Šคํ…œ ์„ค์ •")
3052
 
3053
- st.markdown('<p style="font-size:11px; font-weight:700; color:#4A5568; letter-spacing:1.5px; text-transform:uppercase; margin-bottom:6px;">GEMINI API KEY</p>', unsafe_allow_html=True)
3054
  nk = st.text_input("API KEY", value=st.session_state.api_key, type="password", label_visibility="collapsed")
3055
 
3056
- st.markdown('<p style="font-size:11px; font-weight:700; color:#4A5568; letter-spacing:1.5px; text-transform:uppercase; margin-top:14px; margin-bottom:6px;">๋ถ„์„ ๋ชจ๋ธ</p>', unsafe_allow_html=True)
3057
  nm = st.selectbox("๋ชจ๋ธ", AVAILABLE_MODELS, label_visibility="collapsed",
3058
  index=AVAILABLE_MODELS.index(st.session_state.selected_model)
3059
  if st.session_state.selected_model in AVAILABLE_MODELS else 0)
3060
 
3061
- st.markdown('<p style="font-size:11px; font-weight:700; color:#4A5568; letter-spacing:1.5px; text-transform:uppercase; margin-top:14px; margin-bottom:6px;">๋ฐ์ดํ„ฐ ๊ด€๋ฆฌ</p>', unsafe_allow_html=True)
3062
  c1, c2 = st.columns(2)
3063
  with c1:
3064
  if st.button("๊ฐ€๊ฒฉ ์บ์‹œ ์ดˆ๊ธฐํ™”", use_container_width=True):
@@ -3164,7 +3189,7 @@ components.html("""<!DOCTYPE html>
3164
  itemHtml+='<div class="al-item" data-ticker="'+item.ticker+'" style="display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:10px;cursor:pointer;margin-bottom:'+(ii<items.length-1?'4px':'0')+';background:rgba(255,255,255,0.02);border:1px solid transparent;transition:all 0.18s;"><div style="width:40px;height:40px;border-radius:10px;background:'+cfg.bg+';border:1px solid '+cfg.border+';display:flex;align-items:center;justify-content:center;flex-shrink:0;"><span style="font-size:10px;font-weight:800;color:'+cfg.accent+';">'+item.ticker.slice(0,4)+'</span></div><div style="flex:1;min-width:0;"><div style="display:flex;align-items:center;gap:6px;margin-bottom:2px;"><span style="font-size:12px;font-weight:700;color:#e8eaf0;">'+item.ticker+'</span><span style="font-size:10px;color:rgba(255,255,255,0.35);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">'+item.name+'</span></div><div style="font-size:11px;color:rgba(255,255,255,0.4);">'+item.price+'</div></div><div style="text-align:right;flex-shrink:0;"><div style="font-size:12px;font-weight:700;color:'+cfg.accent+';">'+item.change+'</div><div style="font-size:10px;color:rgba(255,255,255,0.25);margin-top:2px;">โ†’ ์ƒ์„ธ ์ง„๋‹จ</div></div></div>';
3165
  }
3166
  }
3167
- root.innerHTML='<div style="width:360px;"><div style="background:linear-gradient(135deg,#1e2435,#161c2a);border-radius:16px 16px 0 0;border:1px solid rgba(255,255,255,0.08);border-bottom:none;padding:14px 16px 0;"><div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;"><div style="display:flex;align-items:center;gap:8px;"><div style="width:8px;height:8px;border-radius:50%;background:#FF6B35;box-shadow:0 0 8px rgba(255,107,53,0.8);"></div><span style="color:#e8eaf0;font-size:13px;font-weight:700;">LIVE ALERTS</span><span style="background:rgba(255,71,87,0.15);border:1px solid rgba(255,71,87,0.3);border-radius:6px;padding:1px 7px;font-size:11px;color:#FF4757;font-weight:700;">'+cnt+'</span></div><div style="display:flex;align-items:center;gap:6px;"><div style="background:rgba(255,255,255,0.05);border-radius:8px;padding:4px 9px;"><span id="al-timer-span" style="font-size:11px;color:'+(tl>20?'rgba(255,255,255,0.4)':'#FF4757')+';font-weight:600;">'+tl+'s</span></div><button id="al-minbtn" style="background:transparent;border:none;cursor:pointer;color:rgba(255,255,255,0.3);font-size:18px;padding:4px 8px;border-radius:6px;line-height:1;">โˆ’</button></div></div><div style="display:flex;gap:4px;">'+tabHtml+'</div></div><div style="background:linear-gradient(180deg,#161c2a,#131820);border:1px solid rgba(255,255,255,0.08);border-top:2px solid '+cfg.accent+';border-radius:0 0 16px 16px;max-height:300px;overflow-y:auto;padding:8px;">'+itemHtml+'</div></div>';
3168
  pdoc.getElementById('al-minbtn').onclick=function(e){ e.stopPropagation(); s.minimized=true; clearInterval(s.timer); renderPanel(); };
3169
  root.querySelectorAll('.al-tab').forEach(function(btn){ btn.onclick=function(){ s.tab=btn.getAttribute('data-tab'); renderPanel(); }; });
3170
  root.querySelectorAll('.al-item').forEach(function(el){ el.onclick=function(){ gotoTicker(el.getAttribute('data-ticker')); }; });
 
34
  backdrop-filter: blur(20px) !important;
35
  -webkit-backdrop-filter: blur(20px) !important;
36
  z-index: 999999 !important;
37
+ border-top: 1px solid rgba(201,168,76,0.10) !important;
38
  padding-bottom: env(safe-area-inset-bottom) !important;
39
  }
40
  div.element-container:has(.nav-marker) + div [data-testid="stColumns"],
 
48
  }
49
  div.element-container:has(.nav-marker) + div button {
50
  background: transparent !important; border: none !important; box-shadow: none !important;
51
+ color: #5C5247 !important; width: 100% !important; height: 58px !important;
52
  padding: 0 !important; display: block !important; transition: color 0.2s;
53
  }
54
  div.element-container:has(.nav-marker) + div button p {
55
  white-space: pre-wrap !important; text-align: center !important;
56
  font-size: 10px !important; font-weight: 700 !important; line-height: 1.2 !important;
57
+ margin: 0 !important; color: #5C5247 !important; letter-spacing: 0.5px !important;
58
  }
59
  div.element-container:has(.nav-marker) + div button em {
60
  font-style: normal !important; font-size: 20px !important; display: block !important;
61
+ margin-bottom: 3px !important; color: #5C5247 !important;
62
  }
63
  div.element-container:has(.nav-marker) + div button:hover p,
64
  div.element-container:has(.nav-marker) + div button:active p { color: #C9A84C !important; }
 
82
  font-size: 16px !important; display: flex !important; justify-content: center !important;
83
  align-items: center !important; transition: all 0.2s !important;
84
  }
85
+ div.element-container:has(.action-marker.delete) + div button:hover { color: #D45A5A !important; transform: scale(1.15) !important; }
86
+ div.element-container:has(.action-marker.edit) + div button:hover { color: #7EAAD4 !important; transform: scale(1.15) !important; }
87
  div.element-container:has(.action-marker.log) + div button:hover { color: #C9A84C !important; transform: scale(1.15) !important; }
88
  """
89
 
90
  CARD_CSS = """
91
  div.element-container:has(.scan-marker) + div.element-container button {
92
+ background: #181410 !important;
93
+ border: 1px solid rgba(201,168,76,0.10) !important;
94
  border-radius: 10px !important;
95
  padding: 18px 10px !important; display: flex !important; flex-direction: column !important;
96
  align-items: center !important; justify-content: center !important; width: 100% !important;
 
100
  }
101
  div.element-container:has(.scan-marker) + div.element-container button:hover {
102
  border-color: rgba(201,168,76,0.4) !important;
103
+ background: #1E1912 !important;
104
  transform: translateY(-2px) !important;
105
  box-shadow: 0 8px 20px rgba(0,0,0,0.3) !important;
106
  }
 
116
  border: 1px solid rgba(201,168,76,0.2) !important;
117
  }
118
  div.element-container:has(.scan-marker) + div.element-container button strong {
119
+ font-size: 14px !important; font-weight: 700 !important; color: #EEE8DC !important;
120
  display: block !important; margin-bottom: 5px !important;
121
  }
122
  div.element-container:has(.scan-marker) + div.element-container button del {
123
  text-decoration: none !important; font-size: 13px !important; font-weight: 500 !important;
124
+ color: #9A8F7E !important; display: block !important; font-family: 'DM Mono', monospace !important;
125
  }
126
  div.element-container:has(.port-marker) + div.element-container button {
127
+ background: linear-gradient(135deg, #181410 0%, #14110A 100%) !important;
128
  border: 1px solid rgba(201,168,76,0.25) !important;
129
  border-radius: 16px !important;
130
  padding: 26px 20px !important; text-align: center !important;
 
138
  }
139
  div.element-container:has(.port-marker) + div.element-container button p {
140
  white-space: pre-wrap !important; font-size: 11px !important; font-weight: 700 !important;
141
+ color: #5C5247 !important; line-height: 1.8 !important; letter-spacing: 1px !important;
142
  text-transform: uppercase !important;
143
  }
144
  div.element-container:has(.port-marker) + div.element-container button del {
145
  text-decoration: none !important; font-size: 28px !important; font-weight: 500 !important;
146
+ color: #EEE8DC !important; display: block !important; margin: 6px 0 !important;
147
  font-family: 'DM Mono', monospace !important; letter-spacing: -1px !important;
148
  }
149
  div.element-container:has(.port-marker) + div.element-container button strong {
150
+ color: #D45A5A !important; font-size: 14px !important;
151
  font-family: 'DM Mono', monospace !important; font-weight: 700 !important;
152
  }
153
  """
154
 
155
  COMPONENT_CSS = """
156
  .menu-overlay-btn > button {
157
+ background: #181410 !important;
158
+ border: 1px solid rgba(201,168,76,0.10) !important;
159
  border-radius: 12px !important;
160
  padding: 18px 20px !important; font-size: 16px !important; font-weight: 700 !important;
161
+ color: #EEE8DC !important; box-shadow: none !important; margin-bottom: 10px !important;
162
  transition: all 0.15s !important;
163
  }
164
  .menu-overlay-btn > button:hover {
165
  border-color: rgba(201,168,76,0.35) !important;
166
+ background: #1E1912 !important;
167
  }
168
  .menu-overlay-btn > button p {
169
+ font-size: 16px !important; font-weight: 400 !important; margin: 0 !important; color: #EEE8DC !important;
170
  }
171
  div.stButton > button:not([title]) {
172
+ border-radius: 8px; font-weight: 600; padding: 10px 20px; transition: all 0.2s ease;
173
+ border: 1px solid rgba(201,168,76,0.13); width: 100%; word-break: keep-all;
174
+ color: #9A8F7E; background: linear-gradient(135deg, #181410 0%, #100E09 100%); font-size: 13px;
175
+ box-shadow: 0 1px 4px rgba(0,0,0,0.3);
176
  }
177
  div.stButton > button:not([title]):hover {
178
+ border-color: rgba(201,168,76,0.4);
179
  color: #C9A84C;
180
+ background: linear-gradient(135deg, #1E1912 0%, #181410 100%);
181
+ box-shadow: 0 2px 12px rgba(201,168,76,0.08);
182
+ transform: translateY(-1px);
183
  }
184
  button[kind="primary"]:not([title]) {
185
+ background: linear-gradient(135deg, rgba(201,168,76,0.18) 0%, rgba(201,168,76,0.10) 100%) !important;
186
+ border-color: rgba(201,168,76,0.35) !important;
187
  color: #C9A84C !important;
188
+ box-shadow: 0 1px 8px rgba(201,168,76,0.1) !important;
189
  }
190
  button[kind="primary"]:not([title]):hover {
191
+ background: linear-gradient(135deg, rgba(201,168,76,0.28) 0%, rgba(201,168,76,0.18) 100%) !important;
192
+ box-shadow: 0 2px 16px rgba(201,168,76,0.15) !important;
193
  }
194
  @keyframes skeleton-pulse {
195
+ 0% { background-color: #181410; }
196
+ 50% { background-color: #1E1912; }
197
+ 100% { background-color: #181410; }
198
  }
199
  .skeleton-box { border-radius: 10px; animation: skeleton-pulse 1.5s ease-in-out infinite; }
200
  .stock-header-card {
201
+ background: linear-gradient(160deg, #1A1610 0%, #100E09 60%, #0D0B07 100%);
202
+ border: 1px solid rgba(201,168,76,0.18);
203
  border-radius: 16px; padding: 24px;
204
  margin-bottom: 16px; position: relative; overflow: hidden;
205
+ box-shadow: 0 4px 32px rgba(0,0,0,0.5), inset 0 1px 0 rgba(201,168,76,0.12);
206
  }
207
  .stock-header-card::before {
208
  content: '';
209
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
210
+ background: linear-gradient(90deg, transparent, rgba(201,168,76,0.6), rgba(226,192,106,0.8), rgba(201,168,76,0.6), transparent);
211
+ }
212
+ .stock-header-card::after {
213
+ content: '';
214
+ position: absolute; bottom: 0; left: 20%; right: 20%; height: 1px;
215
+ background: linear-gradient(90deg, transparent, rgba(201,168,76,0.15), transparent);
216
  }
217
  .stock-title {
218
+ font-size: 10px; color: #5C5247; font-weight: 700;
219
  text-transform: uppercase; letter-spacing: 2px; margin-bottom: 14px;
220
  display: flex; align-items: center; justify-content: space-between;
221
  }
222
  .stock-name-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
223
+ .stock-name { font-size: 28px; font-weight: 900; color: #EEE8DC; }
224
  .stock-ticker {
225
  font-size: 13px; color: #C9A84C;
226
  background: rgba(201,168,76,0.1); padding: 2px 8px;
 
228
  }
229
  .price-star-row {
230
  display: flex; align-items: center; justify-content: space-between;
231
+ border-top: 1px solid rgba(201,168,76,0.08); padding-top: 18px;
232
  }
233
  .stock-price {
234
  font-size: 36px; font-weight: 500; color: #C9A84C;
 
240
  border-radius: 6px; border: 1px solid rgba(201,168,76,0.2);
241
  }
242
  .conclusion-box {
243
+ background: linear-gradient(135deg, #1A1610 0%, #100E09 100%);
244
+ color: #9A8F7E;
245
  border-radius: 10px; padding: 20px;
246
  margin-bottom: 20px;
247
+ border: 1px solid rgba(201,168,76,0.15);
248
  border-left: 3px solid #C9A84C;
 
 
249
  font-size: 14px; line-height: 1.8;
250
+ box-shadow: 0 2px 16px rgba(0,0,0,0.3), inset 0 1px 0 rgba(201,168,76,0.08);
251
+ }
252
+ .conclusion-box strong { color: #EEE8DC; }
253
+ .report-section {
254
+ margin-bottom: 16px;
255
+ padding-bottom: 16px;
256
+ border-bottom: 1px solid rgba(201,168,76,0.06);
257
  }
258
+ .report-section:last-child { border-bottom: none; }
 
259
  .analysis-header {
260
+ background: linear-gradient(90deg, rgba(201,168,76,0.12), rgba(201,168,76,0.06));
261
  color: #C9A84C; padding: 7px 14px; border-radius: 6px;
262
  font-weight: 700; font-size: 11px; width: fit-content; margin-bottom: 12px;
263
+ border: 1px solid rgba(201,168,76,0.2);
264
+ border-left: 2px solid rgba(201,168,76,0.7);
265
+ letter-spacing: 1px; text-transform: uppercase;
266
+ box-shadow: 0 1px 8px rgba(201,168,76,0.06);
267
  }
268
+ .analysis-content { line-height: 1.9; font-size: 14px; color: #9A8F7E; }
269
+ .analysis-content strong { color: #EEE8DC; font-weight: 700; }
270
  .strategy-badge {
271
  padding: 3px 10px; border-radius: 4px; font-size: 11px;
272
  font-weight: 700; display: inline-block; letter-spacing: 0.3px;
273
  }
274
+ .badge-buy { background: rgba(229,62,62,0.1); color: #D45A5A; border: 1px solid rgba(229,62,62,0.2); }
275
+ .badge-hold { background: rgba(201,168,76,0.05); color: #9A8F7E; border: 1px solid rgba(201,168,76,0.12); }
276
+ .badge-profit { background: rgba(126,170,212,0.1); color: #7EAAD4; border: 1px solid rgba(126,170,212,0.2); }
277
+ .badge-loss { background: rgba(201,168,76,0.04); color: #5C5247; border: 1px solid rgba(201,168,76,0.08); }
278
+ .badge-none { background: transparent; color: #5C5247; border: 1px dashed rgba(201,168,76,0.12); }
279
  .strat-summary-card {
280
+ background: linear-gradient(135deg, #1A1610 0%, #100E09 100%);
281
+ padding: 16px; border-radius: 10px;
282
+ border: 1px solid rgba(201,168,76,0.18);
283
+ box-shadow: inset 0 1px 0 rgba(201,168,76,0.08);
284
  }
285
  .inline-edit-box {
286
+ background: rgba(201,168,76,0.03); padding: 16px; border-radius: 10px;
287
+ border: 1px dashed rgba(201,168,76,0.25); margin-bottom: 12px;
288
+ box-shadow: inset 0 0 20px rgba(201,168,76,0.02);
289
  }
290
  .onboarding-step {
291
+ background: linear-gradient(90deg, rgba(201,168,76,0.05) 0%, #181410 40%);
292
+ border-radius: 10px; padding: 14px 16px; margin-bottom: 10px;
293
+ border: 1px solid rgba(201,168,76,0.12);
294
  border-left: 3px solid #C9A84C;
295
+ color: #9A8F7E; font-size: 14px;
 
296
  }
297
  .analytics-metric {
298
+ background: linear-gradient(160deg, #1A1610 0%, #0D0B07 100%);
299
+ border: 1px solid rgba(201,168,76,0.15);
300
  border-radius: 10px; padding: 18px; text-align: center;
301
+ box-shadow: inset 0 1px 0 rgba(201,168,76,0.1), 0 2px 12px rgba(0,0,0,0.3);
302
  }
303
  .analytics-metric .metric-label {
304
+ font-size: 10px; font-weight: 700; color: #5C5247;
305
  margin-bottom: 6px; letter-spacing: 1.5px; text-transform: uppercase;
306
  }
307
+ .analytics-metric .metric-value { font-size: 24px; font-weight: 700; color: #EEE8DC; font-family: 'DM Mono', monospace; }
308
  .data-badge-ok {
309
  display: inline-flex; align-items: center;
310
+ background: rgba(34,197,94,0.08); color: #6FCF8A;
311
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 4px;
312
  border: 1px solid rgba(74,222,128,0.2); letter-spacing: 0.3px;
313
  }
314
  .data-badge-warn {
315
  display: inline-flex; align-items: center;
316
+ background: rgba(201,168,76,0.08); color: #C9A84C;
317
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 4px;
318
+ border: 1px solid rgba(201,168,76,0.2);
319
  }
320
  @keyframes alertPulse {
321
  0%, 100% { opacity: 1; }
 
329
  @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700;900&family=DM+Mono:wght@400;500&display=swap');
330
  * {{ font-family: 'Noto Sans KR', sans-serif; letter-spacing: -0.2px; }}
331
  .main, [data-testid="stAppViewContainer"] {{
332
+ background-color: #0A0802 !important;
333
  }}
334
+ [data-testid="stMain"] {{ background-color: #0A0802 !important; }}
335
  header[data-testid="stHeader"] {{ display: none !important; }}
336
  .block-container {{ padding-top: 1.5rem !important; padding-bottom: 120px !important; }}
337
+ p, span, div, label, li {{ color: #9A8F7E; }}
338
+ h1, h2, h3, h4 {{ color: #EEE8DC !important; }}
339
+ .stMarkdown p {{ color: #9A8F7E; }}
340
+ hr {{ border-color: rgba(201,168,76,0.08) !important; }}
341
  div.stButton:has(button[title="header_logo"]) {{
342
  background: transparent !important;
343
  }}
 
371
  outline: none !important;
372
  }}
373
  [data-testid="stTextInput"] input {{
374
+ background: #181410 !important;
375
+ border: 1px solid rgba(201,168,76,0.12) !important;
376
  border-radius: 8px !important;
377
+ color: #EEE8DC !important;
378
  font-size: 14px !important;
379
  }}
380
  [data-testid="stTextInput"] input:focus {{
381
  border-color: rgba(201,168,76,0.4) !important;
382
  box-shadow: 0 0 0 2px rgba(201,168,76,0.08) !important;
383
  }}
384
+ [data-testid="stTextInput"] input::placeholder {{ color: #5C5247 !important; }}
385
  [data-testid="stNumberInput"] input {{
386
+ background: #181410 !important;
387
+ border: 1px solid rgba(201,168,76,0.12) !important;
388
  border-radius: 8px !important;
389
+ color: #EEE8DC !important;
390
  }}
391
  [data-testid="stSelectbox"] > div > div {{
392
+ background: #181410 !important;
393
+ border: 1px solid rgba(201,168,76,0.12) !important;
394
  border-radius: 8px !important;
395
+ color: #EEE8DC !important;
396
  }}
397
  [data-testid="stExpander"] {{
398
+ background: #181410 !important;
399
+ border: 1px solid rgba(201,168,76,0.10) !important;
400
  border-radius: 10px !important;
401
  }}
402
  [data-testid="stExpander"] summary {{
403
+ color: #9A8F7E !important;
404
  }}
405
  [data-testid="stVerticalBlock"] > [data-testid="stVerticalBlockBorderWrapper"] {{
406
+ background: #181410 !important;
407
+ border: 1px solid rgba(201,168,76,0.10) !important;
408
  border-radius: 12px !important;
409
  }}
410
  [data-testid="stTabs"] [data-testid="stTab"] {{
411
+ color: #5C5247 !important; font-weight: 600 !important; font-size: 13px !important;
412
  }}
413
  [data-testid="stTabs"] [data-testid="stTab"][aria-selected="true"] {{
414
  color: #C9A84C !important; border-bottom-color: #C9A84C !important;
415
  }}
416
  [data-testid="stSpinner"] {{ color: #C9A84C !important; }}
417
  [data-testid="stAlert"] {{
418
+ background: #181410 !important; border-color: rgba(201,168,76,0.12) !important;
419
+ color: #9A8F7E !important; border-radius: 8px !important;
420
  }}
421
  [data-testid="stSuccess"] {{
422
  background: rgba(74,222,128,0.06) !important;
423
  border-color: rgba(74,222,128,0.15) !important;
424
+ color: #6FCF8A !important; border-radius: 8px !important;
425
  }}
426
  [data-testid="stError"] {{
427
  background: rgba(229,62,62,0.06) !important;
 
430
  }}
431
  [data-testid="stMarkdownContainer"] hr + p,
432
  [data-testid="stMarkdownContainer"] h3 {{
433
+ color: #EEE8DC !important;
434
  }}
435
  iframe[title="components.v1.html"] {{
436
  width: 1px !important;
 
499
  if not st.session_state.api_key:
500
  st.markdown("""
501
  <div style="text-align:center; padding:40px 10px 60px;">
502
+ <div style="font-size:13px; color:#5C5247; margin-bottom:6px; letter-spacing:2px; text-transform:uppercase;">SYSTEM ACCESS</div>
503
+ <p style="color:#9A8F7E; font-size:14px; line-height:1.9;">
504
  ์•ˆ์ „ํ•œ ์‹ค์ „ ๋งค๋งค ๋ถ„์„์„ ์œ„ํ•ด<br>Gemini API KEY๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.
505
  </p>
506
  </div>
 
1185
  if score >= 75:
1186
  color, label, emoji = "#4ADE80", "๋†’์Œ", "๐ŸŸข"
1187
  elif score >= 45:
1188
+ color, label, emoji = "#C9A84C", "๋ณดํ†ต", "๐ŸŸก"
1189
  else:
1190
+ color, label, emoji = "#D45A5A", "๋‚ฎ์Œ", "๐Ÿ”ด"
1191
 
1192
  st.markdown(
1193
+ f'<div style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); '
1194
  f'border-radius:10px; padding:14px 16px; margin-bottom:12px;">'
1195
  f'<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">'
1196
+ f'<span style="font-size:11px; font-weight:700; color:#5C5247; letter-spacing:1px; text-transform:uppercase;">'
1197
  f'{emoji} AI ๋ถ„์„ ์‹ ๋ขฐ๋„</span>'
1198
  f'<span style="font-size:16px; font-weight:900; color:{color};">{score}์  ยท {label}</span>'
1199
  f'</div>'
1200
+ f'<div style="background:rgba(201,168,76,0.06); border-radius:4px; height:6px; margin-bottom:8px;">'
1201
  f'<div style="background:{color}; width:{score}%; height:6px; border-radius:4px; '
1202
  f'transition:width 0.6s ease;"></div></div>'
1203
+ f'<div style="font-size:12px; color:#5C5247;">{reason}</div>'
1204
  f'</div>',
1205
  unsafe_allow_html=True
1206
  )
 
1219
 
1220
  if diff_pct >= 30:
1221
  warn_html = (
1222
+ f'<div style="background:rgba(201,168,76,0.08); border:1px solid rgba(201,168,76,0.25); '
1223
+ f'border-radius:6px; padding:8px 12px; margin-top:10px; font-size:12px; color:#C9A84C;">'
1224
  f'โš ๏ธ AI ๋ชฉํ‘œ๊ฐ€์™€ ์‹ค์ œ ์• ๋„๋ฆฌ์ŠคํŠธ ๋ชฉํ‘œ๊ฐ€๊ฐ€ <b>{diff_pct:.0f}%</b> ์ฐจ์ด๋‚ฉ๋‹ˆ๋‹ค.</div>'
1225
  )
1226
  else:
1227
  warn_html = (
1228
+ f'<div style="background:rgba(111,207,138,0.06); border:1px solid rgba(111,207,138,0.18); '
1229
+ f'border-radius:6px; padding:8px 12px; margin-top:10px; font-size:12px; color:#6FCF8A;">'
1230
  f'โœ… AI ๋ชฉํ‘œ๊ฐ€์™€ ์‹ค์ œ ์• ๋„๋ฆฌ์ŠคํŠธ ๋ชฉํ‘œ๊ฐ€๊ฐ€ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค (์ฐจ์ด {diff_pct:.0f}%).</div>'
1231
  )
1232
 
1233
  st.markdown(
1234
+ f'<div style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); '
1235
  f'border-radius:10px; padding:16px; margin-bottom:12px;">'
1236
+ f'<div style="font-size:11px; font-weight:700; color:#5C5247; letter-spacing:1px; '
1237
  f'text-transform:uppercase; margin-bottom:12px;">๐Ÿ“Š ๋ชฉํ‘œ๊ฐ€ ๋น„๊ต</div>'
1238
  f'<div style="display:grid; grid-template-columns:1fr 1fr; gap:10px;">'
1239
+ f'<div style="background:#0A0802; border-radius:8px; padding:12px; text-align:center;">'
1240
+ f'<div style="font-size:10px; color:#5C5247; margin-bottom:4px;">AI ๋ถ„์„ ๋ชฉํ‘œ๊ฐ€</div>'
1241
  f'<div style="font-size:18px; font-weight:700; color:#C9A84C; font-family:DM Mono,monospace;">'
1242
  f'{ai_price:,}์›</div>'
1243
+ f'<div style="font-size:11px; color:{"#D45A5A" if ai_upside>=0 else "#7EAAD4"}; margin-top:4px;">'
1244
  f'ํ˜„์žฌ๊ฐ€ ๋Œ€๋น„ {ai_upside:+.1f}%</div>'
1245
  f'</div>'
1246
+ f'<div style="background:#0A0802; border-radius:8px; padding:12px; text-align:center;">'
1247
+ f'<div style="font-size:10px; color:#5C5247; margin-bottom:4px;">์ „๋ฌธ๊ฐ€ ํ‰๊ท  ๋ชฉํ‘œ๊ฐ€</div>'
1248
  f'<div style="font-size:18px; font-weight:700; color:#4ECDC4; font-family:DM Mono,monospace;">'
1249
  f'{analyst_target_krw:,}์›</div>'
1250
+ f'<div style="font-size:11px; color:{"#D45A5A" if an_upside>=0 else "#7EAAD4"}; margin-top:4px;">'
1251
  f'ํ˜„์žฌ๊ฐ€ ๋Œ€๋น„ {an_upside:+.1f}%</div>'
1252
  f'</div>'
1253
  f'</div>'
 
1266
  conf_reason = rpt.get("confidence_reason", "")
1267
  catalyst = rpt.get("catalyst", "")
1268
 
1269
+ border_color = "#D45A5A" if "๋งค์ˆ˜" in action else ("#7EAAD4" if "๊ด€๋ง" in action else "rgba(201,168,76,0.12)")
1270
  safe_sum = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(summary).replace('\n',' '))
1271
 
1272
  st.markdown(
1273
  f'<div class="conclusion-box" style="border-left-color:{border_color};">'
1274
+ f'<span style="color:#5C5247; font-size:10px; font-weight:700; letter-spacing:2px; text-transform:uppercase;">์ค‘์žฅ๊ธฐ ์Šค์บ” ๋ฆฌํฌํŠธ</span><br><br>'
1275
+ f'<span style="color:#9A8F7E;">{safe_sum}</span></div>',
1276
  unsafe_allow_html=True
1277
  )
1278
 
 
1286
  f'border-radius:10px; padding:16px; margin-bottom:14px;">'
1287
  f'<div style="font-size:10px; font-weight:700; color:#C9A84C; letter-spacing:1.5px; '
1288
  f'text-transform:uppercase; margin-bottom:8px;">โšก ์ง€๊ธˆ ํˆฌ์žํ•ด์•ผ ํ•  ์ด‰๋งค</div>'
1289
+ f'<div style="font-size:14px; color:#9A8F7E; line-height:1.8;">{safe_cat}</div></div>',
1290
  unsafe_allow_html=True
1291
  )
1292
 
 
1302
  inner = ""
1303
  if safe_q:
1304
  inner += (
1305
+ f'<div style="background:rgba(201,168,76,0.03); border:1px solid rgba(201,168,76,0.08); border-radius:8px; padding:12px; margin-bottom:8px;">'
1306
+ f'<div style="font-size:9px; color:#5C5247; margin-bottom:6px; text-transform:uppercase; '
1307
  f'letter-spacing:1.5px;">๐Ÿ“Š ์ •๋Ÿ‰ ๊ทผ๊ฑฐ</div>'
1308
  f'<div class="analysis-content" style="margin:0;">{safe_q}</div>'
1309
  f'</div>'
1310
  )
1311
  if safe_ql:
1312
  inner += (
1313
+ f'<div style="background:rgba(201,168,76,0.03); border:1px solid rgba(201,168,76,0.08); border-radius:8px; padding:12px;">'
1314
+ f'<div style="font-size:9px; color:#9A8F7E; margin-bottom:6px; text-transform:uppercase; '
1315
  f'letter-spacing:1.5px;">๐Ÿ’ก ์ •์„ฑ ํŒ๋‹จ</div>'
1316
  f'<div class="analysis-content" style="margin:0;">{safe_ql}</div>'
1317
  f'</div>'
 
1335
  zs = zones.get("stop_thesis", "-")
1336
  zones_html = (
1337
  f'<div style="display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; margin-top:12px;">'
1338
+ f'<div style="background:#0A0802; border-radius:8px; padding:12px; text-align:center;">'
1339
+ f'<div style="font-size:9px; color:#5C5247; margin-bottom:4px; text-transform:uppercase; letter-spacing:1px;">1์ฐจ ๋ถ„ํ• ๋งค์ˆ˜</div>'
1340
+ f'<div style="font-size:13px; font-weight:700; color:#6FCF8A;">{z1}</div></div>'
1341
+ f'<div style="background:#0A0802; border-radius:8px; padding:12px; text-align:center;">'
1342
+ f'<div style="font-size:9px; color:#5C5247; margin-bottom:4px; text-transform:uppercase; letter-spacing:1px;">2์ฐจ ์ถ”๊ฐ€๋งค์ˆ˜</div>'
1343
+ f'<div style="font-size:13px; font-weight:700; color:#C9A84C;">{z2}</div></div>'
1344
+ f'<div style="background:#0A0802; border-radius:8px; padding:12px; text-align:center;">'
1345
+ f'<div style="font-size:9px; color:#5C5247; margin-bottom:4px; text-transform:uppercase; letter-spacing:1px;">ํ…Œ์ œ ๋ถ•๊ดด์„ </div>'
1346
+ f'<div style="font-size:13px; font-weight:700; color:#D45A5A;">{zs}</div></div>'
1347
  f'</div>'
1348
  )
1349
  st.markdown(
 
1370
  if hedge:
1371
  safe = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(hedge).replace('\n','<br>'))
1372
  st.markdown(
1373
+ f'<div style="background:rgba(66,153,225,0.04); border:1px solid rgba(126,170,212,0.15); '
1374
  f'border-radius:10px; padding:16px; margin-bottom:14px;">'
1375
+ f'<div class="analysis-header" style="background:rgba(126,170,212,0.08); color:#7EAAD4; '
1376
  f'border-color:rgba(66,153,225,0.2);">4์ˆœ์œ„ ยท ๊ธฐ์ˆ ์ฃผ ๋ฆฌ์Šคํฌ ํ—ค์ง€</div>'
1377
  f'<div class="analysis-content">{safe}</div></div>',
1378
  unsafe_allow_html=True
 
1394
  t = rec.get("ticker","N/A"); n = rec.get("name","Unknown"); r = rec.get("reason","")
1395
  with cols[i % len(cols)]:
1396
  st.markdown(
1397
+ f'<div style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); border-radius:10px; padding:18px; margin-bottom:10px;">'
1398
+ f'<div style="font-size:15px; font-weight:800; color:#EEE8DC; margin-bottom:4px;">{n}</div>'
1399
  f'<div style="font-size:11px; color:#C9A84C; background:rgba(201,168,76,0.1); display:inline-block; padding:2px 8px; border-radius:4px; margin-bottom:10px; border:1px solid rgba(201,168,76,0.2);">{t}</div>'
1400
+ f'<div style="font-size:13px; color:#9A8F7E; line-height:1.6;">{r}</div></div>',
1401
  unsafe_allow_html=True
1402
  )
1403
  if st.button(f"์Šค์บ” โ€” {t}", key=f"re_scan_btn_{i}_{t}", use_container_width=True):
 
1417
  conf_reason = rpt.get("confidence_reason", "")
1418
 
1419
  border_color = {
1420
+ "๋ณด์œ ": "rgba(201,168,76,0.14)",
1421
+ "์ถ”๊ฐ€๋งค์ˆ˜": "#D45A5A",
1422
+ "์ต์ ˆ": "#7EAAD4",
1423
+ "์†์ ˆ": "#D45A5A",
1424
+ }.get(action, "rgba(201,168,76,0.12)")
1425
 
1426
  safe_sum = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(summary).replace('\n',' '))
1427
  st.markdown(
1428
  f'<div class="conclusion-box" style="border-left-color:{border_color};">'
1429
+ f'<span style="color:#5C5247; font-size:10px; font-weight:700; letter-spacing:2px; text-transform:uppercase;">๋ณด์œ  ์ข…๋ชฉ ์ง„๋‹จ ๋ฆฌํฌํŠธ</span><br><br>'
1430
+ f'<span style="color:#9A8F7E;">{safe_sum}</span></div>',
1431
  unsafe_allow_html=True
1432
  )
1433
 
 
1444
  no_reason = (not orig or "๋ฏธ๊ธฐ๋ก" in orig or "ํ™•์ธ ๋ถˆ๊ฐ€" in orig)
1445
  if no_reason:
1446
  st.markdown(
1447
+ '<div style="background:rgba(201,168,76,0.04); border:1px solid rgba(201,168,76,0.12); '
1448
  'border-radius:12px; padding:20px; margin-bottom:14px;">'
1449
  '<div style="display:flex; align-items:center; gap:10px; margin-bottom:12px;">'
1450
  '<div class="analysis-header" style="margin-bottom:0;">1์ˆœ์œ„ ยท ๋งค์ˆ˜ ํ…Œ์ œ ์œ ํšจ์„ฑ</div>'
1451
+ '<span style="font-size:12px; font-weight:700; color:#5C5247; '
1452
+ 'background:rgba(201,168,76,0.05); border:1px solid rgba(201,168,76,0.12); '
1453
  'padding:3px 12px; border-radius:20px;">๊ทผ๊ฑฐ ๋ฏธ๊ธฐ๋ก</span>'
1454
  '</div>'
1455
+ '<div style="font-size:14px; color:#9A8F7E; line-height:1.9; margin-bottom:14px;">'
1456
+ '๋งค์ˆ˜ ๋‹น์‹œ ์ƒ๊ฐ์„ ๊ธฐ๋กํ•ด๋‘๋ฉด <b style="color:#EEE8DC;">์ง€๊ธˆ ๊ทธ ์ด์œ ๊ฐ€ ์‚ด์•„์žˆ๋Š”์ง€</b>๋ฅผ '
1457
  '์ •ํ™•ํ•˜๊ฒŒ ํŒ๋‹จํ•ด๋“œ๋ฆด ์ˆ˜ ์žˆ์–ด์š”.<br>'
1458
  '์žฌ๋ฌด ๋ฐ์ดํ„ฐ ๊ธฐ๋ฐ˜ ๋ถ„์„์€ ์•„๋ž˜์—์„œ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์ง€๋งŒ, '
1459
  '"๋‚ด๊ฐ€ ์™œ ์ƒ€๋Š”๊ฐ€"์™€์˜ ๋น„๊ต๋Š” ์ด๋ฒˆ ๋ถ„์„์—์„œ ๋น ์กŒ์Šต๋‹ˆ๋‹ค.'
1460
  '</div>'
1461
+ '<div style="font-size:12px; color:#5C5247; '
1462
  'background:rgba(201,168,76,0.04); border:1px solid rgba(201,168,76,0.12); '
1463
  'border-radius:8px; padding:10px 14px;">'
1464
  '๐Ÿ’ก ํฌํŠธํด๋ฆฌ์˜ค ๋ชฉ๋ก์—์„œ <b style="color:#C9A84C;">โœŽ ํŽธ์ง‘</b>์„ ๋ˆŒ๋Ÿฌ ๋งค์ˆ˜ ๊ทผ๊ฑฐ๋ฅผ ์ถ”๊ฐ€ํ•˜๋ฉด, '
 
1468
  unsafe_allow_html=True
1469
  )
1470
  else:
1471
+ verdict_color = {"์œ ํšจ": "#4ADE80", "ํ›ผ์†": "#D45A5A", "์ ๊ฒ€ํ•„์š”": "#C9A84C"}.get(verdict, "#9A8F7E")
1472
+ verdict_bg = {"์œ ํšจ": "rgba(74,222,128,0.08)", "ํ›ผ์†": "rgba(229,62,62,0.08)", "์ ๊ฒ€ํ•„์š”": "rgba(201,168,76,0.08)"}.get(verdict, "rgba(201,168,76,0.05)")
1473
  quant_chk = thesis.get("quantitative_check", "")
1474
  qual_chk = thesis.get("qualitative_check", "")
1475
  safe_curr = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(curr).replace('\n','<br>'))
 
1480
  check_blocks = ""
1481
  if safe_qn:
1482
  check_blocks += (
1483
+ f'<div style="background:rgba(201,168,76,0.03); border:1px solid rgba(201,168,76,0.08); border-radius:8px; padding:12px; margin-bottom:8px;">'
1484
+ f'<div style="font-size:9px; color:#5C5247; margin-bottom:5px; text-transform:uppercase; letter-spacing:1.5px;">๐Ÿ“Š ์ •๋Ÿ‰ ์ ๊ฒ€</div>'
1485
+ f'<div style="font-size:13px; color:#9A8F7E; line-height:1.7;">{safe_qn}</div>'
1486
  f'</div>'
1487
  )
1488
  if safe_ql:
1489
  check_blocks += (
1490
+ f'<div style="background:rgba(201,168,76,0.03); border:1px solid rgba(201,168,76,0.08); border-radius:8px; padding:12px; margin-bottom:8px;">'
1491
+ f'<div style="font-size:9px; color:#9A8F7E; margin-bottom:5px; text-transform:uppercase; letter-spacing:1.5px;">๐Ÿ’ก ์ •์„ฑ ์ ๊ฒ€</div>'
1492
+ f'<div style="font-size:13px; color:#9A8F7E; line-height:1.7;">{safe_ql}</div>'
1493
  f'</div>'
1494
  )
1495
  # ์ •๋Ÿ‰/์ •์„ฑ ์—†์œผ๋ฉด ๊ธฐ์กด current_status ๊ทธ๋Œ€๋กœ (๊ตฌ๋ฒ„์ „ ์บ์‹œ ํ˜ธํ™˜)
1496
  if not check_blocks:
1497
+ check_blocks = f'<div style="font-size:14px; color:#9A8F7E; line-height:1.8;">{safe_curr}</div>'
1498
  else:
1499
  check_blocks += (
1500
+ f'<div style="background:rgba(201,168,76,0.03); border:1px solid rgba(201,168,76,0.07); border-radius:8px; padding:10px 12px; margin-top:4px;">'
1501
+ f'<div style="font-size:9px; color:#5C5247; margin-bottom:4px; text-transform:uppercase; letter-spacing:1.5px;">โš–๏ธ ์ข…ํ•ฉ ํŒ์ •</div>'
1502
+ f'<div style="font-size:13px; color:#EEE8DC; line-height:1.7; font-weight:500;">{safe_curr}</div>'
1503
  f'</div>'
1504
  )
1505
 
 
1512
  f'background:{verdict_bg}; border:1px solid {verdict_color}55; '
1513
  f'padding:3px 12px; border-radius:20px;">{verdict}</span>'
1514
  f'</div>'
1515
+ f'<div style="background:rgba(0,0,0,0.25); border-radius:8px; padding:12px; margin-bottom:10px;">'
1516
+ f'<div style="font-size:10px; color:#5C5247; margin-bottom:4px; text-transform:uppercase; letter-spacing:1px;">๋งค์ˆ˜ ๋‹น์‹œ ๊ทผ๊ฑฐ</div>'
1517
+ f'<div style="font-size:13px; color:#9A8F7E;">{orig}</div>'
1518
  f'</div>'
1519
  f'{check_blocks}'
1520
  f'</div>',
 
1539
  condition = add_buy.get("condition", "")
1540
  forbidden = add_buy.get("forbidden_condition", "")
1541
  sug_price = add_buy.get("suggested_price", "-")
1542
+ poss_color = "#4ADE80" if possible else "#D45A5A"
1543
  poss_label = "์ถ”๊ฐ€๋งค์ˆ˜ ๊ฐ€๋Šฅ" if possible else "์ถ”๊ฐ€๋งค์ˆ˜ ์ฃผ์˜"
1544
  st.markdown(
1545
+ f'<div style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); '
1546
  f'border-radius:10px; padding:16px; margin-bottom:14px;">'
1547
  f'<div style="display:flex; align-items:center; gap:10px; margin-bottom:12px;">'
1548
  f'<div class="analysis-header" style="margin-bottom:0;">3์ˆœ์œ„ ยท ์ถ”๊ฐ€๋งค์ˆ˜ ํŒ๋‹จ</div>'
 
1551
  f'padding:2px 10px; border-radius:10px;">{poss_label}</span>'
1552
  f'</div>'
1553
  f'<div style="display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:10px;">'
1554
+ f'<div style="background:rgba(111,207,138,0.06); border:1px solid rgba(111,207,138,0.18); '
1555
  f'border-radius:8px; padding:10px;">'
1556
+ f'<div style="font-size:9px; color:#6FCF8A; font-weight:700; margin-bottom:4px; text-transform:uppercase;">๊ฐ€๋Šฅ ์กฐ๊ฑด</div>'
1557
+ f'<div style="font-size:12px; color:#9A8F7E;">{condition}</div></div>'
1558
+ f'<div style="background:rgba(212,90,90,0.06); border:1px solid rgba(212,90,90,0.18); '
1559
  f'border-radius:8px; padding:10px;">'
1560
+ f'<div style="font-size:9px; color:#D45A5A; font-weight:700; margin-bottom:4px; text-transform:uppercase;">๊ธˆ์ง€ ์กฐ๊ฑด</div>'
1561
+ f'<div style="font-size:12px; color:#9A8F7E;">{forbidden}</div></div>'
1562
  f'</div>'
1563
+ f'<div style="text-align:center; background:#0A0802; border-radius:6px; padding:8px;">'
1564
+ f'<span style="font-size:11px; color:#5C5247;">์ถ”๊ฐ€๋งค์ˆ˜ ์ ์ •๊ฐ€</span>'
1565
  f'<span style="font-size:15px; font-weight:700; color:#C9A84C; margin-left:10px; font-family:DM Mono,monospace;">{sug_price}</span>'
1566
  f'</div></div>',
1567
  unsafe_allow_html=True
 
1574
  upside = target_rem.get("upside_pct", "-")
1575
  exit_s = target_rem.get("exit_strategy", "-")
1576
  st.markdown(
1577
+ f'<div style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); '
1578
  f'border-radius:10px; padding:16px; margin-bottom:14px;">'
1579
  f'<div class="analysis-header">4์ˆœ์œ„ ยท ๋ชฉํ‘œ๊ฐ€ ์ž”์—ฌ</div>'
1580
  f'<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px;">'
1581
  f'<div>'
1582
+ f'<div style="font-size:10px; color:#5C5247; margin-bottom:4px;">๋ชฉํ‘œ๊ฐ€</div>'
1583
  f'<div style="font-size:22px; font-weight:700; color:#C9A84C; font-family:DM Mono,monospace;">{tp}</div>'
1584
  f'</div>'
1585
  f'<div style="text-align:right;">'
1586
+ f'<div style="font-size:10px; color:#5C5247; margin-bottom:4px;">์ƒ์Šน ์—ฌ๋ ฅ</div>'
1587
+ f'<div style="font-size:22px; font-weight:700; color:#6FCF8A; font-family:DM Mono,monospace;">{upside}</div>'
1588
  f'</div></div>'
1589
+ f'<div style="background:#0A0802; border-radius:6px; padding:10px; font-size:12px; color:#9A8F7E;">'
1590
+ f'<span style="color:#5C5247; font-weight:700;">๋งค๋„ ์ „๋žต ยท </span>{exit_s}</div>'
1591
  f'</div>',
1592
  unsafe_allow_html=True
1593
  )
 
1606
  safe_sum = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(summary).replace('\n',' '))
1607
  st.markdown(
1608
  f'<div class="conclusion-box" style="border-left-color:#C9A84C;">'
1609
+ f'<span style="color:#5C5247; font-size:10px; font-weight:700; letter-spacing:2px; text-transform:uppercase;">ํฌํŠธํด๋ฆฌ์˜ค ์ข…ํ•ฉ ์ง„๋‹จ</span><br><br>'
1610
+ f'<span style="color:#9A8F7E;">{safe_sum}</span></div>',
1611
  unsafe_allow_html=True
1612
  )
1613
 
 
1619
  risk_level = corr.get("risk_level", "๋ณดํ†ต")
1620
  risk_groups = corr.get("risk_groups", [])
1621
  worst = corr.get("worst_scenario", "")
1622
+ risk_color = {"๋‚ฎ์Œ":"#4ADE80","๋ณดํ†ต":"#C9A84C","๋†’์Œ":"#D45A5A","๋งค์šฐ๋†’์Œ":"#D45A5A"}.get(risk_level, "#C9A84C")
1623
 
1624
  groups_html = "".join([
1625
  f'<div style="background:rgba(229,62,62,0.04); border:1px solid rgba(229,62,62,0.12); '
1626
+ f'border-radius:6px; padding:8px 12px; margin-bottom:6px; font-size:13px; color:#9A8F7E;">'
1627
  f'โš ๏ธ {g}</div>'
1628
  for g in risk_groups
1629
  ])
1630
  safe_worst = re.sub(r'\*\*(.*?)\*\*', r'<strong>\1</strong>', str(worst))
1631
 
1632
  st.markdown(
1633
+ f'<div style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); '
1634
  f'border-radius:12px; padding:20px; margin-bottom:14px;">'
1635
  f'<div style="display:flex; align-items:center; gap:10px; margin-bottom:14px;">'
1636
  f'<div class="analysis-header" style="margin-bottom:0;">1์ˆœ์œ„ ยท ๋™์‹œ ํ•˜๋ฝ ์œ„ํ—˜</div>'
 
1639
  f'padding:3px 12px; border-radius:20px;">์œ„ํ—˜๋„: {risk_level}</span>'
1640
  f'</div>'
1641
  f'{groups_html}'
1642
+ f'<div style="background:rgba(229,62,62,0.06); border-left:3px solid #D45A5A; '
1643
+ f'border-radius:0 6px 6px 0; padding:10px 14px; margin-top:10px; font-size:13px; color:#9A8F7E;">'
1644
+ f'<b style="color:#D45A5A;">์ตœ์•… ์‹œ๋‚˜๋ฆฌ์˜ค ยท </b>{safe_worst}</div>'
1645
  f'</div>',
1646
  unsafe_allow_html=True
1647
  )
 
1655
 
1656
  sell_html = "".join([
1657
  f'<div style="background:rgba(229,62,62,0.04); border:1px solid rgba(229,62,62,0.12); '
1658
+ f'border-radius:6px; padding:8px 12px; margin-bottom:4px; font-size:13px; color:#9A8F7E;">'
1659
  f'๐Ÿ“ค {s}</div>'
1660
  for s in sell_list
1661
  ])
1662
  buy_html = "".join([
1663
  f'<div style="background:rgba(74,222,128,0.04); border:1px solid rgba(74,222,128,0.12); '
1664
+ f'border-radius:6px; padding:8px 12px; margin-bottom:4px; font-size:13px; color:#9A8F7E;">'
1665
  f'๐Ÿ“ฅ {b}</div>'
1666
  for b in buy_list
1667
  ])
1668
 
1669
  st.markdown(
1670
+ f'<div style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); '
1671
  f'border-radius:12px; padding:20px; margin-bottom:14px;">'
1672
  f'<div class="analysis-header">2์ˆœ์œ„ ยท ๋ฆฌ๋ฐธ๋Ÿฐ์‹ฑ ์šฐ์„ ์ˆœ์œ„</div>'
1673
  f'<div style="display:grid; grid-template-columns:1fr 1fr; gap:12px;">'
1674
  f'<div>'
1675
+ f'<div style="font-size:10px; color:#D45A5A; font-weight:700; margin-bottom:8px; text-transform:uppercase; letter-spacing:1px;">๋จผ์ € ๋งค๋„</div>'
1676
+ f'{sell_html if sell_html else "<div style=\'font-size:13px;color:#5C5247;\'>ํ•ด๋‹น ์—†์Œ</div>"}'
1677
  f'</div>'
1678
  f'<div>'
1679
+ f'<div style="font-size:10px; color:#6FCF8A; font-weight:700; margin-bottom:8px; text-transform:uppercase; letter-spacing:1px;">์ถ”๊ฐ€ ๋งค์ˆ˜</div>'
1680
+ f'{buy_html if buy_html else "<div style=\'font-size:13px;color:#5C5247;\'>ํ•ด๋‹น ์—†์Œ</div>"}'
1681
  f'</div>'
1682
  f'</div>'
1683
+ f'{"<div style=\'background:rgba(66,153,225,0.06);border:1px solid rgba(126,170,212,0.15);border-radius:8px;padding:10px 14px;margin-top:12px;font-size:13px;color:#9A8F7E;\'><b style=\'color:#7EAAD4;\'>ํ—ค์ง€ ์ถ”์ฒœ ยท </b>" + hedge_s + "</div>" if hedge_s else ""}'
1684
  f'</div>',
1685
  unsafe_allow_html=True
1686
  )
 
1692
  base = outlook.get("base", "-")
1693
  pess = outlook.get("pessimistic", "-")
1694
  st.markdown(
1695
+ f'<div style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); '
1696
  f'border-radius:10px; padding:16px; margin-bottom:14px;">'
1697
  f'<div class="analysis-header">3์ˆœ์œ„ ยท 6๊ฐœ์›” ์ˆ˜์ต๋ฅ  ์ „๋ง</div>'
1698
  f'<div style="display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px;">'
1699
  f'<div style="background:rgba(74,222,128,0.06); border:1px solid rgba(74,222,128,0.15); border-radius:8px; padding:12px; text-align:center;">'
1700
+ f'<div style="font-size:9px; color:#6FCF8A; font-weight:700; margin-bottom:6px; text-transform:uppercase;">๋‚™๊ด€</div>'
1701
+ f'<div style="font-size:15px; font-weight:700; color:#6FCF8A; font-family:DM Mono,monospace;">{opt}</div></div>'
1702
  f'<div style="background:rgba(234,179,8,0.06); border:1px solid rgba(234,179,8,0.15); border-radius:8px; padding:12px; text-align:center;">'
1703
+ f'<div style="font-size:9px; color:#C9A84C; font-weight:700; margin-bottom:6px; text-transform:uppercase;">๊ธฐ๋ณธ</div>'
1704
+ f'<div style="font-size:15px; font-weight:700; color:#C9A84C; font-family:DM Mono,monospace;">{base}</div></div>'
1705
  f'<div style="background:rgba(229,62,62,0.06); border:1px solid rgba(229,62,62,0.15); border-radius:8px; padding:12px; text-align:center;">'
1706
+ f'<div style="font-size:9px; color:#D45A5A; font-weight:700; margin-bottom:6px; text-transform:uppercase;">๋น„๊ด€</div>'
1707
+ f'<div style="font-size:15px; font-weight:700; color:#D45A5A; font-family:DM Mono,monospace;">{pess}</div></div>'
1708
  f'</div></div>',
1709
  unsafe_allow_html=True
1710
  )
 
1717
  gvt = conc.get("growth_vs_turnaround", "")
1718
  qn_conc = conc.get("quantitative_concentration", "")
1719
  ql_conc = conc.get("qualitative_concentration", "")
1720
+ tech_color = "#D45A5A" if tech_w >= 70 else ("#C9A84C" if tech_w >= 50 else "#4ADE80")
1721
 
1722
  conc_detail = ""
1723
  if qn_conc:
1724
  safe_qn = qn_conc.replace("\n","<br>")
1725
  conc_detail += (
1726
+ f'<div style="background:rgba(0,0,0,0.25); border-radius:8px; padding:10px 12px; margin-bottom:8px;">'
1727
+ f'<div style="font-size:9px; color:#5C5247; margin-bottom:5px; text-transform:uppercase; letter-spacing:1.5px;">๐Ÿ“Š ์ •๋Ÿ‰ ์ง‘์ค‘๋„</div>'
1728
+ f'<div style="font-size:13px; color:#9A8F7E; line-height:1.7;">{safe_qn}</div>'
1729
  f'</div>'
1730
  )
1731
  if ql_conc:
1732
  safe_ql = ql_conc.replace("\n","<br>")
1733
  conc_detail += (
1734
+ f'<div style="background:rgba(0,0,0,0.25); border-radius:8px; padding:10px 12px; margin-bottom:8px;">'
1735
+ f'<div style="font-size:9px; color:#9A8F7E; margin-bottom:5px; text-transform:uppercase; letter-spacing:1.5px;">๐Ÿ’ก ์ •์„ฑ ์ง‘์ค‘๋„ (ํ…Œ๋งˆ ์ค‘๋ณต)</div>'
1736
+ f'<div style="font-size:13px; color:#9A8F7E; line-height:1.7;">{safe_ql}</div>'
1737
  f'</div>'
1738
  )
1739
  if not conc_detail and warn_m:
1740
+ conc_detail = f'<div style="font-size:13px; color:#9A8F7E; margin-bottom:8px;">{warn_m}</div>'
1741
 
1742
  st.markdown(
1743
+ f'<div style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); '
1744
  f'border-radius:10px; padding:16px; margin-bottom:14px;">'
1745
  f'<div class="analysis-header">4์ˆœ์œ„ ยท ์ง‘์ค‘๋„ ๊ฒฝ๊ณ </div>'
1746
  f'<div style="display:flex; align-items:center; gap:16px; margin-bottom:12px;">'
1747
  f'<div>'
1748
+ f'<div style="font-size:10px; color:#5C5247; margin-bottom:2px;">๊ธฐ์ˆ ์ฃผ ๋น„์ค‘</div>'
1749
  f'<div style="font-size:28px; font-weight:900; color:{tech_color}; font-family:DM Mono,monospace;">{tech_w}%</div>'
1750
  f'</div>'
1751
+ f'<div style="background:rgba(201,168,76,0.05); border-radius:6px; height:8px; flex:1;">'
1752
  f'<div style="background:{tech_color}; width:{min(tech_w,100)}%; height:8px; border-radius:6px;"></div>'
1753
  f'</div></div>'
1754
  f'{conc_detail}'
1755
+ f'{"<div style='background:#0A0802;border-radius:6px;padding:8px 12px;font-size:12px;color:#9A8F7E;'><b style='color:#5C5247;'>์„ฑ์žฅ์ฃผ vs ํ„ด์–ด๋ผ์šด๋“œ ยท </b>" + gvt + "</div>" if gvt else ""}'
1756
  f'</div>',
1757
  unsafe_allow_html=True
1758
  )
 
1767
  t = rec.get("ticker","N/A"); n = rec.get("name","Unknown"); r = rec.get("reason","")
1768
  with cols[i % len(cols)]:
1769
  st.markdown(
1770
+ f'<div style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); border-radius:10px; padding:18px; margin-bottom:10px;">'
1771
+ f'<div style="font-size:15px; font-weight:800; color:#EEE8DC; margin-bottom:4px;">{n}</div>'
1772
  f'<div style="font-size:11px; color:#C9A84C; background:rgba(201,168,76,0.1); display:inline-block; padding:2px 8px; border-radius:4px; margin-bottom:10px; border:1px solid rgba(201,168,76,0.2);">{t}</div>'
1773
+ f'<div style="font-size:13px; color:#9A8F7E; line-height:1.6;">{r}</div></div>',
1774
  unsafe_allow_html=True
1775
  )
1776
  if st.button(f"์Šค์บ” โ€” {t}", key=f"port_rec_btn_{i}_{t}", use_container_width=True):
 
1793
  fig = go.Figure(go.Candlestick(
1794
  x=hist.index, open=hist['Open'], high=hist['High'],
1795
  low=hist['Low'], close=hist['Close'],
1796
+ increasing_line_color='#C9A84C', decreasing_line_color='#5C7A8A'
1797
  ))
1798
  fig.update_layout(
1799
  height=240, margin=dict(l=0,r=0,t=0,b=0),
1800
  paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0)',
1801
  xaxis=dict(showgrid=False, visible=False, rangeslider=dict(visible=False)),
1802
+ yaxis=dict(showgrid=True, gridcolor='rgba(201,168,76,0.05)', visible=False),
1803
  hovermode="x unified"
1804
  )
1805
  st.plotly_chart(fig, use_container_width=True, config={'displayModeBar':False})
 
1807
  fig2 = go.Figure(go.Scatter(
1808
  x=hist.index, y=hist['Close'], fill='tozeroy', mode='lines',
1809
  line=dict(color='#C9A84C', width=2),
1810
+ fillcolor='rgba(201,168,76,0.08)'
1811
  ))
1812
  fig2.update_layout(
1813
  height=240, margin=dict(l=0,r=0,t=0,b=0),
1814
  paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0)',
1815
  xaxis=dict(showgrid=False, visible=False),
1816
+ yaxis=dict(showgrid=True, gridcolor='rgba(201,168,76,0.05)', visible=False),
1817
  hovermode="x unified"
1818
  )
1819
  st.plotly_chart(fig2, use_container_width=True, config={'displayModeBar':False})
 
1882
  def render_price_alert(level, message, ticker, name):
1883
  if level is None: return
1884
  cfg = {
1885
+ 'tp_hit': ("#7EAAD4", "rgba(126,170,212,0.08)", "rgba(66,153,225,0.25)", "์ต์ ˆ ๋ชฉํ‘œ ๋„๋‹ฌ"),
1886
+ 'tp': ("#7EAAD4", "rgba(66,153,225,0.06)", "rgba(66,153,225,0.18)", "์ต์ ˆ ์ž„๋ฐ•"),
1887
+ 'sl': ("#D45A5A", "rgba(229,62,62,0.06)", "rgba(229,62,62,0.2)", "์†์ ˆ ์ฃผ์˜"),
1888
+ 'sl_broken': ("#D45A5A", "rgba(229,62,62,0.1)", "rgba(229,62,62,0.35)", "์†์ ˆ๊ฐ€ ์ดํƒˆ"),
1889
  }
1890
  color, bg, border, label = cfg.get(level, ("#C9A84C","rgba(201,168,76,0.06)","rgba(201,168,76,0.2)","์•Œ๋ฆผ"))
1891
  pulse = "animation:alertPulse 1.8s ease-in-out infinite;" if "broken" in level or "hit" in level else ""
 
1915
  f'<span class="stock-name">{name}</span>'
1916
  f'<span class="stock-ticker">{ticker}</span></div>'
1917
  f'<div class="price-star-row">'
1918
+ f'<span class="stock-price">{price:,}<span style="font-size:16px;color:#5C5247;margin-left:4px;">์›</span></span>'
1919
  f'<div class="star-rating">{stars}</div></div></div>',
1920
  unsafe_allow_html=True
1921
  )
 
1934
  st.markdown("### ๋งค๋งค ์„ฑ๊ณผ ๋ถ„์„")
1935
  c1, c2, c3, c4 = st.columns(4)
1936
  for col, label, val, color in [
1937
+ (c1, "์ด ๋ˆ„์  ์‹คํ˜„์†์ต", f"{int(total):,}์›", "#D45A5A" if total>=0 else "#7EAAD4"),
1938
+ (c2, "์Šน๋ฅ ", f"{wr:.1f}%", "#4ADE80" if wr>=bew else "#D45A5A"),
1939
+ (c3, "์†์ต๋น„ (R)", f"{rr:.2f}", "#4ADE80" if rr>=1.5 else "#C9A84C"),
1940
+ (c4, "์ด ๋งค๋งค ํšŸ์ˆ˜", f"{len(tdf)}ํšŒ", "#EEE8DC"),
1941
  ]:
1942
  with col:
1943
  st.markdown(
 
1948
  )
1949
 
1950
  r_msg = "์šฐ์ˆ˜ (1.5โ†‘)" if rr>=1.5 else ("์–‘ํ˜ธ (1.0โ†‘)" if rr>=1.0 else "๊ฐœ์„  ํ•„์š”")
1951
+ r_color = "#4ADE80" if rr>=1.5 else ("#C9A84C" if rr>=1.0 else "#D45A5A")
1952
  st.markdown(
1953
+ f'<div style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); border-radius:8px; '
1954
+ f'padding:14px 16px; margin-top:14px; font-size:13px; color:#9A8F7E;">'
1955
  f'<b style="color:{r_color};">์†์ต๋น„: {r_msg}</b> &nbsp;|&nbsp; '
1956
+ f'<span style="color:#5C5247;">์†์ต๋ถ„๊ธฐ ์Šน๋ฅ : {bew:.1f}% (ํ˜„์žฌ: {wr:.1f}%)</span></div>',
1957
  unsafe_allow_html=True
1958
  )
1959
  st.markdown("#### ์ „๋žต ํƒœ๊ทธ๋ณ„ ์„ฑ๊ณผ")
1960
  ts = tdf.groupby('ํƒœ๊ทธ')['์‹คํ˜„์†์ต'].agg(ํšŸ์ˆ˜='count', ํ•ฉ๊ณ„='sum').reset_index().sort_values('ํ•ฉ๊ณ„', ascending=False)
1961
  for _, row in ts.iterrows():
1962
+ c = "#D45A5A" if row['ํ•ฉ๊ณ„'] >= 0 else "#7EAAD4"
1963
  st.markdown(
1964
  f'<div style="display:flex; justify-content:space-between; align-items:center; '
1965
+ f'background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); border-radius:8px; '
1966
  f'padding:12px 16px; margin-bottom:6px;">'
1967
+ f'<span style="font-weight:700; color:#EEE8DC;">{row["ํƒœ๊ทธ"]}</span>'
1968
+ f'<span style="font-size:12px; color:#5C5247;">{int(row["ํšŸ์ˆ˜"])}ํšŒ</span>'
1969
  f'<span style="font-weight:700; color:{c}; font-family:DM Mono,monospace;">{int(row["ํ•ฉ๊ณ„"]):+,}์›</span></div>',
1970
  unsafe_allow_html=True
1971
  )
 
2116
  '@keyframes alItemIn{{from{{transform:translateX(12px);opacity:0}}to{{transform:translateX(0);opacity:1}}}}' +
2117
  '#' + PID + ' *{{box-sizing:border-box;font-family:"JetBrains Mono","Noto Sans KR",monospace;}}' +
2118
  '#' + PID + ' ::-webkit-scrollbar{{width:4px}}' +
2119
+ '#' + PID + ' ::-webkit-scrollbar-thumb{{background:rgba(201,168,76,0.14);border-radius:2px}}' +
2120
+ '#' + PID + ' .al-item:hover{{background:rgba(201,168,76,0.07)!important;transform:translateX(-2px)}}' +
2121
  '#' + PID + ' .al-tab:hover{{opacity:1!important}}' +
2122
+ '#' + PID + ' .al-minbtn:hover{{background:rgba(201,168,76,0.14)!important}}';
2123
  pdoc.head.appendChild(st);
2124
  }}
2125
  function hideAlertBtn() {{
 
2293
  root.innerHTML =
2294
  '<div style="width:360px;animation:alSlideUp 0.4s cubic-bezier(0.34,1.56,0.64,1);">' +
2295
  '<div style="background:linear-gradient(135deg,#1e2435,#161c2a);' +
2296
+ 'border-radius:16px 16px 0 0;border:1px solid rgba(201,168,76,0.12);' +
2297
  'border-bottom:none;padding:14px 16px 0;">' +
2298
  '<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;">' +
2299
  '<div style="display:flex;align-items:center;gap:8px;">' +
 
2304
  'border-radius:6px;padding:1px 7px;font-size:11px;color:#FF4757;font-weight:700;">' + cnt + '</span>' +
2305
  '</div>' +
2306
  '<div style="display:flex;align-items:center;gap:6px;">' +
2307
+ '<div style="background:rgba(201,168,76,0.06);border-radius:8px;padding:4px 9px;">' +
2308
  '<span id="al-timer-span" style="font-size:11px;color:' + (tl > 20 ? 'rgba(255,255,255,0.4)' : '#FF4757') + ';font-weight:600;">' + tl + 's</span>' +
2309
  '</div>' +
2310
  '<button id="al-minbtn" class="al-minbtn" style="background:transparent;border:none;cursor:pointer;' +
 
2315
  '<div style="display:flex;gap:4px;">' + tabHtml + '</div>' +
2316
  '</div>' +
2317
  '<div style="background:linear-gradient(180deg,#161c2a,#131820);' +
2318
+ 'border:1px solid rgba(201,168,76,0.12);border-top:2px solid ' + cfg.accent + ';' +
2319
  'border-radius:0 0 16px 16px;max-height:300px;overflow-y:auto;padding:8px;">' +
2320
  itemHtml +
2321
  '</div>' +
 
2402
 
2403
  if st.session_state.df.empty:
2404
  st.markdown("""
2405
+ <div style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); border-radius:14px; padding:28px; margin-bottom:20px;">
2406
+ <h3 style="color:#EEE8DC; margin-bottom:18px; font-size:18px;">Invest Pro Alpha์— ์˜ค์‹  ๊ฑธ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค</h3>
2407
  <div class="onboarding-step"><b style="color:#C9A84C;">Step 1.</b> ์ž์‚ฐ ์ƒ์„ธ ์ง„๋‹จ โ†’ ๋ณด์œ  ์ข…๋ชฉ ์ถ”๊ฐ€</div>
2408
  <div class="onboarding-step"><b style="color:#C9A84C;">Step 2.</b> AI ์Šค์บ”์œผ๋กœ ์ค‘์žฅ๊ธฐ ์„ฑ์žฅ์ฃผ ๋ถ„์„</div>
2409
  <div class="onboarding-step"><b style="color:#C9A84C;">Step 3.</b> ๋งค๋งค ์ผ์ง€๋กœ ์Šน๋ฅ ยท์†์ต๋น„ ๋ฐ์ดํ„ฐ ์Œ“๊ธฐ</div>
 
2416
  with st.spinner("ํฌํŠธํด๋ฆฌ์˜ค ๋ถ„์„ ์ค‘..."):
2417
  msg = get_ai_alert(", ".join(port_ai), _key_hash(), st.session_state.selected_model)
2418
  st.markdown(
2419
+ f'<div style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); '
2420
  f'border-left:3px solid #C9A84C; '
2421
  f'padding:14px 16px; border-radius:8px; margin-bottom:16px;">'
2422
  f'<div style="font-size:10px; font-weight:700; color:#C9A84C; margin-bottom:6px; letter-spacing:2px; text-transform:uppercase;">AI PORTFOLIO BRIEFING</div>'
2423
+ f'<span style="font-size:13px; color:#9A8F7E; line-height:1.7;">{msg}</span></div>',
2424
  unsafe_allow_html=True
2425
  )
2426
 
 
2505
  tp = get_analyst_target(tn)
2506
  if tp > 0:
2507
  st.markdown(
2508
+ f"<div style='text-align:right; font-size:13px; color:#5C5247; margin-top:-12px; margin-bottom:14px;'>"
2509
+ f"์ „๋ฌธ๊ฐ€ ํ‰๊ท  ๋ชฉํ‘œ๊ฐ€ <b style='color:#9A8F7E;'>{tp:,}์›</b></div>",
2510
  unsafe_allow_html=True
2511
  )
2512
  draw_chart(tn)
 
2587
  'border-radius:10px; padding:16px 18px; margin-bottom:14px;">'
2588
  '<div style="font-size:11px; font-weight:700; color:#C9A84C; letter-spacing:1.5px; '
2589
  'text-transform:uppercase; margin-bottom:8px;">โœ๏ธ ๋งค์ˆ˜ ๊ทผ๊ฑฐ ๋ฏธ๊ธฐ๋ก</div>'
2590
+ '<div style="font-size:13px; color:#9A8F7E; line-height:1.8; margin-bottom:12px;">'
2591
+ '๋งค์ˆ˜ ๋‹น์‹œ ์ƒ๊ฐ์„ ์ ์–ด๋‘๋ฉด <b style="color:#EEE8DC;">ํ…Œ์ œ ์œ ํšจ์„ฑ</b>์„ ์ •ํ™•ํ•˜๊ฒŒ ํŒ๋‹จํ•  ์ˆ˜ ์žˆ์–ด์š”.<br>'
2592
  '์ง€๊ธˆ ์ž…๋ ฅํ•˜์ง€ ์•Š์•„๋„ ๋ถ„์„์€ ๋ฐ”๋กœ ์ง„ํ–‰๋˜์ง€๋งŒ, ๊ธฐ๋ก์ด ์—†์œผ๋ฉด "์™œ ์ƒ€๋Š”๊ฐ€" ๋น„๊ต๊ฐ€ ๋น ์ง‘๋‹ˆ๋‹ค.'
2593
  '</div>'
2594
  '</div>',
 
2643
  render_stock_header(n, dt, p, stars, "๋ณด์œ  ์ข…๋ชฉ ์ง„๋‹จ ๋ฆฌํฌํŠธ", has_rich)
2644
 
2645
  # ๋ณด์œ  ๊ธฐ๊ฐ„ & ์ˆ˜์ต๋ฅ  ๋ฐฐ์ง€
2646
+ p_color = "#D45A5A" if p_pct >= 0 else "#7EAAD4"
2647
  p_arrow = "โ–ฒ" if p_pct >= 0 else "โ–ผ"
2648
  st.markdown(
2649
  f'<div style="display:flex; gap:8px; margin-top:-12px; margin-bottom:14px; flex-wrap:wrap;">'
2650
+ f'<span style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); border-radius:6px; '
2651
+ f'padding:4px 10px; font-size:12px; color:#5C5247;">๋ณด์œ  {holding_days}</span>'
2652
+ f'<span style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); border-radius:6px; '
2653
  f'padding:4px 10px; font-size:12px; color:{p_color}; font-weight:700;">'
2654
  f'{p_arrow} {abs(p_pct):.2f}%</span>'
2655
  f'</div>',
 
2659
  tp = get_analyst_target(dt)
2660
  if tp > 0:
2661
  st.markdown(
2662
+ f"<div style='text-align:right; font-size:13px; color:#5C5247; margin-top:-8px; margin-bottom:14px;'>"
2663
+ f"์ „๋ฌธ๊ฐ€ ํ‰๊ท  ๋ชฉํ‘œ๏ฟฝ๏ฟฝ๏ฟฝ <b style='color:#9A8F7E;'>{tp:,}์›</b></div>",
2664
  unsafe_allow_html=True
2665
  )
2666
  draw_chart(dt)
 
2724
  dv['์ˆ˜์ต๋ฅ '] = dv.apply(lambda r: ((r['ํ˜„์žฌ๊ฐ€']/r['ํ‰๋‹จ๊ฐ€'])-1)*100 if r['ํ‰๋‹จ๊ฐ€']>0 else 0, axis=1)
2725
  fig = px.treemap(
2726
  dv, path=['์ข…๋ชฉ๋ช…'], values='ํ‰๊ฐ€์•ก', color='์ˆ˜์ต๋ฅ ',
2727
+ color_continuous_scale=['#5C7A8A','#1A1610','#C9A84C'],
2728
  color_continuous_midpoint=0, custom_data=['์ˆ˜์ต๋ฅ ','ํ˜„์žฌ๊ฐ€','ํ‹ฐ์ปค']
2729
  )
2730
  fig.update_traces(
2731
+ textfont=dict(family="Noto Sans KR", size=14, color="#EEE8DC"),
2732
+ marker=dict(line=dict(color='#0A0802', width=2)),
2733
  texttemplate="<b>%{label}</b><br><span style='font-size:12px;'>%{customdata[0]:.1f}%</span>",
2734
  hovertemplate='<b>%{label} (%{customdata[2]})</b><br>ํ‰๊ฐ€์•ก: %{value:,.0f}์›<br>์ˆ˜์ต๋ฅ : %{customdata[0]:.2f}%<extra></extra>'
2735
  )
 
2900
  st.markdown('<div class="portfolio-item-row-marker"></div>', unsafe_allow_html=True)
2901
  ct, cl2, ce, cd = st.columns([0.7,0.1,0.1,0.1], vertical_alignment="center")
2902
  with ct:
2903
+ tv_color = {"์œ ํšจ":"#4ADE80","ํ›ผ์†":"#D45A5A","์ ๊ฒ€ํ•„์š”":"#C9A84C"}.get(tv, "#5C5247")
2904
  tv_html = f'<span style="font-size:9px; color:{tv_color}; background:{tv_color}15; border:1px solid {tv_color}44; padding:1px 6px; border-radius:3px; margin-left:6px;">{tv}</span>' if tv else ""
2905
  st.markdown(
2906
+ f'<div style="font-size:16px; font-weight:800; color:#EEE8DC;">'
2907
  f'{row["์ข…๋ชฉ๋ช…"]} '
2908
  f'<span style="font-size:11px; color:#C9A84C; background:rgba(201,168,76,0.1); '
2909
  f'padding:2px 6px; border-radius:4px; border:1px solid rgba(201,168,76,0.2);">{t}</span>'
 
2924
  st.session_state.df = st.session_state.df.drop(idx).reset_index(drop=True)
2925
  save_assets(); st.session_state.price_cache_ts=0; st.rerun()
2926
 
2927
+ pc = "#D45A5A" if pct>=0 else "#7EAAD4"
2928
  pa = "โ–ฒ" if pct>=0 else "โ–ผ"
2929
  st.markdown(
2930
+ f'<div style="font-size:13px; color:#9A8F7E; margin-top:8px; margin-bottom:10px;">'
2931
+ f'ํ‰๋‹จ <b style="color:#EEE8DC; font-family:DM Mono,monospace;">{int(ap):,}</b>์› &nbsp;ยท&nbsp; '
2932
+ f'ํ˜„์žฌ <b style="color:#EEE8DC; font-family:DM Mono,monospace;">{ck:,}</b>์› &nbsp;ยท&nbsp; '
2933
  f'<span style="color:{pc}; font-weight:700; font-family:DM Mono,monospace;">{pa} {abs(pct):.2f}%</span></div>',
2934
  unsafe_allow_html=True
2935
  )
2936
  st.markdown(
2937
+ f'<div style="background:#0A0802; border:1px solid rgba(201,168,76,0.07); border-radius:6px; '
2938
+ f'padding:10px 14px; font-size:13px; color:#9A8F7E; margin-bottom:10px;">'
2939
+ f'์ „๋žต <span style="color:#EEE8DC; font-weight:700;">[{act}]</span>'
2940
  f' &nbsp;ยท&nbsp; ๋ชฉํ‘œ๊ฐ€ <span style="color:#C9A84C;">{tgp}</span></div>',
2941
  unsafe_allow_html=True
2942
  )
 
2947
  st.markdown(
2948
  f'<div style="background:rgba(201,168,76,0.05); border:1px solid rgba(201,168,76,0.15); '
2949
  f'border-left:3px solid rgba(201,168,76,0.4); border-radius:6px; '
2950
+ f'padding:10px 14px; font-size:13px; color:#9A8F7E; margin-bottom:10px;">'
2951
  f'<span style="font-size:10px; color:#C9A84C; font-weight:700; letter-spacing:1px; '
2952
  f'text-transform:uppercase; display:block; margin-bottom:5px;">'
2953
  f'๋งค์ˆ˜ ๊ทผ๊ฑฐ{(" ยท " + buy_date) if buy_date else ""}</span>'
 
2963
 
2964
  if st.session_state.get(f"log_mode_{idx}", False):
2965
  st.markdown('<div class="inline-edit-box" style="border-color:rgba(66,153,225,0.2);">', unsafe_allow_html=True)
2966
+ st.markdown(f'<b style="color:#EEE8DC; font-size:14px;">{row["์ข…๋ชฉ๋ช…"]} ๋งค๋งค ๋ณต๊ธฐ</b>', unsafe_allow_html=True)
2967
  lc1, lc2 = st.columns(2)
2968
  with lc1: sp = st.number_input("๋งค๋„ ๋‹จ๊ฐ€(์›)", value=float(ck), step=100.0, key=f"sp_{idx}")
2969
  with lc2: sq = st.number_input("๋งค๋„ ์ˆ˜๋Ÿ‰", value=float(row['์ˆ˜๋Ÿ‰']), max_value=float(row['์ˆ˜๋Ÿ‰']), min_value=0.01, step=1.0, key=f"sq_{idx}")
 
3022
  st.markdown("### ๋งค๋งค ๊ธฐ๋ก")
3023
  for _, log in st.session_state.trade_df.iterrows():
3024
  ip = log['์‹คํ˜„์†์ต'] >= 0
3025
+ pnl_color = "#D45A5A" if ip else "#7EAAD4"
3026
  log_reason = str(log.get('๋งค์ˆ˜๊ทผ๊ฑฐ', '') or '').strip()
3027
  reason_html = (
3028
  f'<div style="background:rgba(201,168,76,0.05); border:1px solid rgba(201,168,76,0.12); '
3029
+ f'border-radius:5px; padding:8px 12px; font-size:12px; color:#9A8F7E; margin-top:8px;">'
3030
  f'<span style="color:#C9A84C; font-weight:700; font-size:10px; letter-spacing:1px; '
3031
  f'text-transform:uppercase;">๋งค์ˆ˜ ๊ทผ๊ฑฐ</span> &nbsp;{log_reason}</div>'
3032
  ) if log_reason else ''
3033
  st.markdown(
3034
+ f'<div style="background:linear-gradient(135deg,#1A1610 0%,#100E09 100%); border:1px solid rgba(201,168,76,0.15); '
3035
  f'padding:16px; border-radius:10px; margin-bottom:8px;">'
3036
  f'<div style="display:flex; justify-content:space-between; align-items:baseline; margin-bottom:8px;">'
3037
  f'<div>'
3038
+ f'<span style="font-size:15px; font-weight:800; color:#EEE8DC;">{log["์ข…๋ชฉ๋ช…"]}</span>'
3039
+ f'<span style="font-size:11px; color:#5C5247; margin-left:8px; font-family:DM Mono,monospace;">{log["์ผ์‹œ"]}</span>'
3040
  f'</div>'
3041
  f'<div style="font-weight:700; color:{pnl_color}; font-family:DM Mono,monospace;">'
3042
  f'{("+" if ip else "")}{int(log["์‹คํ˜„์†์ต"]):,}์›</div></div>'
3043
+ f'<div style="font-size:13px; color:#9A8F7E; margin-bottom:8px; font-family:DM Mono,monospace;">'
3044
  f'{log["๊ตฌ๋ถ„"]}๊ฐ€ {int(log["๋งค๋งค๊ฐ€"]):,}์› ยท {log["์ˆ˜๋Ÿ‰"]}์ฃผ</div>'
3045
+ f'<div style="background:#0A0802; padding:10px 12px; border-radius:6px; font-size:13px; color:#9A8F7E;">'
3046
  f'<span style="color:#C9A84C; font-weight:700;">{log["ํƒœ๊ทธ"]}</span>'
3047
  f'<span style="margin-left:8px;">{log["๋ฉ”๋ชจ"]}</span></div>'
3048
  f'{reason_html}</div>',
 
3052
  elif st.session_state.main_menu == "โ˜… ๊ด€์‹ฌ ์ข…๋ชฉ":
3053
  st.markdown("### ๊ด€์‹ฌ ์ข…๋ชฉ")
3054
  st.markdown(
3055
+ '<p style="font-size:13px; color:#5C5247; margin-bottom:16px;">์Šค์บ” ๋˜๋Š” ์ž์‚ฐ ์ƒ์„ธ์—์„œ ๊ด€์‹ฌ์ข…๋ชฉ์œผ๋กœ ์ถ”๊ฐ€ํ•œ ์ข…๋ชฉ์ž…๋‹ˆ๋‹ค.</p>',
3056
  unsafe_allow_html=True
3057
  )
3058
  st.divider()
 
3075
  elif st.session_state.main_menu == "โš™ ์‹œ์Šคํ…œ ์„ค์ •":
3076
  st.markdown("### ์‹œ์Šคํ…œ ์„ค์ •")
3077
 
3078
+ st.markdown('<p style="font-size:11px; font-weight:700; color:#5C5247; letter-spacing:1.5px; text-transform:uppercase; margin-bottom:6px;">GEMINI API KEY</p>', unsafe_allow_html=True)
3079
  nk = st.text_input("API KEY", value=st.session_state.api_key, type="password", label_visibility="collapsed")
3080
 
3081
+ st.markdown('<p style="font-size:11px; font-weight:700; color:#5C5247; letter-spacing:1.5px; text-transform:uppercase; margin-top:14px; margin-bottom:6px;">๋ถ„์„ ๋ชจ๋ธ</p>', unsafe_allow_html=True)
3082
  nm = st.selectbox("๋ชจ๋ธ", AVAILABLE_MODELS, label_visibility="collapsed",
3083
  index=AVAILABLE_MODELS.index(st.session_state.selected_model)
3084
  if st.session_state.selected_model in AVAILABLE_MODELS else 0)
3085
 
3086
+ st.markdown('<p style="font-size:11px; font-weight:700; color:#5C5247; letter-spacing:1.5px; text-transform:uppercase; margin-top:14px; margin-bottom:6px;">๋ฐ์ดํ„ฐ ๊ด€๋ฆฌ</p>', unsafe_allow_html=True)
3087
  c1, c2 = st.columns(2)
3088
  with c1:
3089
  if st.button("๊ฐ€๊ฒฉ ์บ์‹œ ์ดˆ๊ธฐํ™”", use_container_width=True):
 
3189
  itemHtml+='<div class="al-item" data-ticker="'+item.ticker+'" style="display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:10px;cursor:pointer;margin-bottom:'+(ii<items.length-1?'4px':'0')+';background:rgba(255,255,255,0.02);border:1px solid transparent;transition:all 0.18s;"><div style="width:40px;height:40px;border-radius:10px;background:'+cfg.bg+';border:1px solid '+cfg.border+';display:flex;align-items:center;justify-content:center;flex-shrink:0;"><span style="font-size:10px;font-weight:800;color:'+cfg.accent+';">'+item.ticker.slice(0,4)+'</span></div><div style="flex:1;min-width:0;"><div style="display:flex;align-items:center;gap:6px;margin-bottom:2px;"><span style="font-size:12px;font-weight:700;color:#e8eaf0;">'+item.ticker+'</span><span style="font-size:10px;color:rgba(255,255,255,0.35);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">'+item.name+'</span></div><div style="font-size:11px;color:rgba(255,255,255,0.4);">'+item.price+'</div></div><div style="text-align:right;flex-shrink:0;"><div style="font-size:12px;font-weight:700;color:'+cfg.accent+';">'+item.change+'</div><div style="font-size:10px;color:rgba(255,255,255,0.25);margin-top:2px;">โ†’ ์ƒ์„ธ ์ง„๋‹จ</div></div></div>';
3190
  }
3191
  }
3192
+ root.innerHTML='<div style="width:360px;"><div style="background:linear-gradient(135deg,#1e2435,#161c2a);border-radius:16px 16px 0 0;border:1px solid rgba(201,168,76,0.12);border-bottom:none;padding:14px 16px 0;"><div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;"><div style="display:flex;align-items:center;gap:8px;"><div style="width:8px;height:8px;border-radius:50%;background:#FF6B35;box-shadow:0 0 8px rgba(255,107,53,0.8);"></div><span style="color:#e8eaf0;font-size:13px;font-weight:700;">LIVE ALERTS</span><span style="background:rgba(255,71,87,0.15);border:1px solid rgba(255,71,87,0.3);border-radius:6px;padding:1px 7px;font-size:11px;color:#FF4757;font-weight:700;">'+cnt+'</span></div><div style="display:flex;align-items:center;gap:6px;"><div style="background:rgba(201,168,76,0.06);border-radius:8px;padding:4px 9px;"><span id="al-timer-span" style="font-size:11px;color:'+(tl>20?'rgba(255,255,255,0.4)':'#FF4757')+';font-weight:600;">'+tl+'s</span></div><button id="al-minbtn" style="background:transparent;border:none;cursor:pointer;color:rgba(255,255,255,0.3);font-size:18px;padding:4px 8px;border-radius:6px;line-height:1;">โˆ’</button></div></div><div style="display:flex;gap:4px;">'+tabHtml+'</div></div><div style="background:linear-gradient(180deg,#161c2a,#131820);border:1px solid rgba(201,168,76,0.12);border-top:2px solid '+cfg.accent+';border-radius:0 0 16px 16px;max-height:300px;overflow-y:auto;padding:8px;">'+itemHtml+'</div></div>';
3193
  pdoc.getElementById('al-minbtn').onclick=function(e){ e.stopPropagation(); s.minimized=true; clearInterval(s.timer); renderPanel(); };
3194
  root.querySelectorAll('.al-tab').forEach(function(btn){ btn.onclick=function(){ s.tab=btn.getAttribute('data-tab'); renderPanel(); }; });
3195
  root.querySelectorAll('.al-item').forEach(function(el){ el.onclick=function(){ gotoTicker(el.getAttribute('data-ticker')); }; });