/* ═══════════════════════════════════════════════════════════════
   투챙이 대시보드 - Premium Dark Investment Theme
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ── 색상 토큰 ── */
:root {
  --bg-base:      #0a0e1a;
  --bg-surface:   #111827;
  --bg-elevated:  #1a2236;
  --bg-hover:     #1f2d45;

  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139,92,246,0.25);
  --accent-green:  #10b981;
  --accent-green-glow: rgba(16,185,129,0.2);
  --accent-blue:   #3b82f6;
  --accent-blue-glow: rgba(59,130,246,0.2);
  --accent-orange: #f59e0b;
  --accent-orange-glow: rgba(245,158,11,0.2);
  --accent-red:    #ef4444;

  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #475569;

  --border:        rgba(255,255,255,0.07);
  --border-hover:  rgba(255,255,255,0.15);

  --sidebar-w: 220px;
  --topbar-h:  64px;
  --radius:    12px;
  --radius-lg: 20px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Outfit', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ══════════════════════════ LOGIN ══════════════════════════ */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-base);
  z-index: 100;
}

.login-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(139,92,246,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139,92,246,0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black, transparent);
}

.login-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 420px;
  text-align: center;
  box-shadow: 0 0 80px rgba(139,92,246,0.15);
}

.login-logo {
  font-size: 56px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(139,92,246,0.5));
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.login-title {
  font-size: 32px; font-weight: 800;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.login-subtitle {
  color: var(--text-secondary); font-size: 14px; margin-bottom: 28px;
}

.login-features {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 32px;
}
.feature-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px; color: var(--text-secondary);
  text-align: left;
}

.btn-login {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: white; color: #1a1a1a;
  border: none; border-radius: 10px;
  padding: 13px 20px;
  font-size: 15px; font-weight: 600; font-family: 'Outfit', sans-serif;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.btn-login:active { transform: translateY(0); }

.login-note { color: var(--text-muted); font-size: 12px; margin-top: 12px; }

.btn-text {
  background: none; border: none;
  color: var(--text-muted); font-size: 13px;
  cursor: pointer; margin-top: 12px;
  font-family: 'Outfit', sans-serif;
  transition: color 0.2s;
}
.btn-text:hover { color: var(--text-secondary); }

/* ══════════════════════════ APP LAYOUT ══════════════════════════ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Sidebar Collapsed State ── */
.app.collapsed {
  --sidebar-w: 72px;
}

.btn-sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}
.btn-sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--accent-purple);
}

.app.collapsed .sidebar-brand {
  flex-direction: column;
  padding: 0 0 16px;
  gap: 8px;
}
.app.collapsed .sidebar-brand .brand-name {
  display: none;
}
.app.collapsed .sidebar-brand .btn-sidebar-toggle {
  margin-left: 0;
  margin-top: 4px;
}

.app.collapsed .sidebar-nav {
  padding: 0 8px;
}
.app.collapsed .nav-item {
  justify-content: center;
  padding: 10px;
}
.app.collapsed .nav-item span:not(.nav-icon) {
  display: none;
}
.app.collapsed .nav-item .badge-soon {
  display: none;
}

.app.collapsed .sidebar-footer {
  flex-direction: column;
  gap: 12px;
  padding: 16px 0 0;
}
.app.collapsed .user-info {
  justify-content: center;
}
.app.collapsed #user-name-sidebar {
  display: none;
}


/* ── Sidebar ── */
.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 0;
  overflow: hidden;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.brand-icon { font-size: 24px; filter: drop-shadow(0 0 8px rgba(139,92,246,0.6)); }
.brand-name { font-size: 20px; font-weight: 700;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 0 12px; }
.nav-section {
  padding: 14px 14px 6px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
  user-select: none;
}
.nav-section:first-child { padding-top: 4px; }
/* 사이드바 접힘 상태: 그룹 라벨 텍스트는 숨기고 얇은 구분선만 표시 */
.app.collapsed .nav-section {
  padding: 0; margin: 8px 6px; height: 1px;
  overflow: hidden; color: transparent; background: var(--border);
}
.app.collapsed .nav-section:first-child { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  background: none; border: none;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px; font-weight: 500; font-family: 'Outfit', sans-serif;
  width: 100%; text-align: left;
  transition: all 0.2s;
  position: relative;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(59,130,246,0.1));
  color: var(--accent-purple);
  border: 1px solid rgba(139,92,246,0.25);
}
.nav-icon { font-size: 16px; }

.badge-soon {
  margin-left: auto;
  background: rgba(245,158,11,0.15);
  color: var(--accent-orange);
  font-size: 9px; font-weight: 700;
  padding: 2px 6px; border-radius: 999px;
  border: 1px solid rgba(245,158,11,0.3);
}

.sidebar-footer {
  padding: 16px 20px 0;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.user-info { display: flex; align-items: center; gap: 8px; flex: 1; }
.user-avatar { font-size: 20px; }
#user-name-sidebar { font-size: 13px; color: var(--text-secondary); }
.btn-logout {
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 6px;
  padding: 4px 8px; cursor: pointer; font-size: 16px;
  transition: all 0.2s;
}
.btn-logout:hover { border-color: var(--accent-red); color: var(--accent-red); }

/* ── Main Content ── */
.main-content {
  display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg-base);
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.page-title { font-size: 20px; font-weight: 700; }
.last-updated { font-size: 12px; color: var(--text-muted); }

.btn-icon {
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-secondary); border-radius: 8px;
  width: 36px; height: 36px; cursor: pointer;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.btn-icon:hover { border-color: var(--border-hover); color: var(--text-primary); }

.btn-primary-sm {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  border: none; color: white; border-radius: 8px;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  font-family: 'Outfit', sans-serif; cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}
.btn-primary-sm:hover { opacity: 0.9; transform: translateY(-1px); }

/* ── Tab Panels ── */
.tab-panel {
  flex: 1; overflow-y: auto;
  padding: 24px 28px;
  display: flex; flex-direction: column; gap: 20px;
}
.tab-panel.hidden { display: none; }

/* ══════════════════════════ CARDS ══════════════════════════ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; }

.btn-text-sm {
  background: none; border: none;
  color: var(--accent-purple); font-size: 13px;
  cursor: pointer; font-family: 'Outfit', sans-serif;
  transition: opacity 0.2s;
}
.btn-text-sm:hover { opacity: 0.75; }

/* ══════════════════════════ METRICS GRID ══════════════════════════ */
.metrics-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative; overflow: hidden;
  transition: transform 0.2s;
}
.metric-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.metric-card:hover { transform: translateY(-2px); }

.metric-card.accent-purple { border-color: rgba(139,92,246,0.3); box-shadow: 0 0 20px var(--accent-purple-glow); }
.metric-card.accent-purple::before { background: var(--accent-purple); }
.metric-card.accent-green  { border-color: rgba(16,185,129,0.3);  box-shadow: 0 0 20px var(--accent-green-glow); }
.metric-card.accent-green::before  { background: var(--accent-green); }
.metric-card.accent-blue   { border-color: rgba(59,130,246,0.3);  box-shadow: 0 0 20px var(--accent-blue-glow); }
.metric-card.accent-blue::before   { background: var(--accent-blue); }
.metric-card.accent-orange { border-color: rgba(245,158,11,0.3);  box-shadow: 0 0 20px var(--accent-orange-glow); }
.metric-card.accent-orange::before { background: var(--accent-orange); }

.metric-label  { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 8px; }
.metric-value  { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.metric-sub    { font-size: 11px; color: var(--text-muted); }
.metric-delta  { font-size: 11px; font-weight: 600; margin-top: 5px; }
.metric-delta:empty { display: none; }

/* ══════════════════════════ CHARTS ══════════════════════════ */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card .chart-wrap { height: 200px; }

/* ══════════════════════════ TABLE ══════════════════════════ */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left; padding: 10px 12px;
  color: var(--text-muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.data-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; transition: color 0.15s; }
.data-table th.sortable:hover { color: var(--text-primary); }
.sort-ind { color: var(--accent-purple); font-size: 10px; }
.data-table td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary);
}
.data-table tr:hover td { background: var(--bg-hover); color: var(--text-primary); }
.empty-state { text-align: center; color: var(--text-muted); padding: 40px 0; font-size: 14px; }

.badge-buy  { background: rgba(16,185,129,0.15); color: var(--accent-green);  padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-sell { background: rgba(239,68,68,0.15);  color: var(--accent-red);    padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pos { color: var(--accent-green); font-weight: 600; }
.neg { color: var(--accent-red);   font-weight: 600; }
.yield-pos {
  color: var(--accent-red);
  font-weight: 700;
}
.yield-neg {
  color: var(--accent-blue);
  font-weight: 700;
}
.market-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.market-pill[data-market="코스피"] {
  background: rgba(59,130,246,0.14);
  border-color: rgba(59,130,246,0.28);
  color: #93c5fd;
}
.market-pill[data-market="코스닥"] {
  background: rgba(139,92,246,0.14);
  border-color: rgba(139,92,246,0.28);
  color: #c4b5fd;
}
.market-pill[data-market="나스닥"] {
  background: rgba(16,185,129,0.14);
  border-color: rgba(16,185,129,0.28);
  color: #6ee7b7;
}
.market-pill[data-market="NYSE"] {
  background: rgba(245,158,11,0.14);
  border-color: rgba(245,158,11,0.28);
  color: #fcd34d;
}
.market-pill[data-market="기타"] {
  background: rgba(148,163,184,0.14);
  border-color: rgba(148,163,184,0.22);
  color: #cbd5e1;
}

/* ══════════════════════════ 3단계 필터 ══════════════════════════ */
.filter-intro {
  background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(59,130,246,0.05));
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: var(--radius);
  padding: 14px 20px;
  color: var(--text-secondary); font-size: 14px; text-align: center;
}

.filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.filter-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; gap: 16px;
  padding: 20px;
  transition: border-color 0.3s;
}
.filter-card.green { border-color: var(--accent-green); box-shadow: 0 0 20px var(--accent-green-glow); }
.filter-card.red   { border-color: var(--accent-red);   box-shadow: 0 0 20px rgba(239,68,68,0.15); }
.filter-card.gray  { border-color: var(--border); }

.filter-number {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; flex-shrink: 0;
}
.filter-body { flex: 1; }
.filter-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.filter-desc  { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }

.signal-display {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.signal-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  animation: pulse-dot 2s infinite;
}
.signal-dot.green  { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); }
.signal-dot.red    { background: var(--accent-red);   box-shadow: 0 0 8px var(--accent-red); }
.signal-dot.gray   { background: var(--text-muted); animation: none; }
@keyframes pulse-dot {
  0%,100% { opacity: 1; } 50% { opacity: 0.4; }
}
.signal-text { font-size: 13px; font-weight: 600; }

.filter-checklist {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 14px;
}
.filter-checklist label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-secondary); cursor: pointer;
}
.filter-checklist input[type="checkbox"] { accent-color: var(--accent-purple); }

.btn-save-filter {
  width: 100%;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-secondary); border-radius: 8px;
  padding: 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: 'Outfit', sans-serif;
  transition: all 0.2s;
}
.btn-save-filter:hover {
  border-color: var(--accent-purple); color: var(--accent-purple);
  background: rgba(139,92,246,0.1);
}

.final-verdict {
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px; text-align: center;
  transition: border-color 0.5s, box-shadow 0.5s;
}
.final-verdict.verdict-go   { border-color: var(--accent-green); box-shadow: 0 0 40px var(--accent-green-glow); }
.final-verdict.verdict-stop { border-color: var(--accent-red);   box-shadow: 0 0 40px rgba(239,68,68,0.15); }
.verdict-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
.verdict-value { font-size: 36px; font-weight: 800; margin-bottom: 8px; }
.verdict-note  { font-size: 13px; color: var(--text-muted); }

/* ══════════════════════════ AI 분석 ══════════════════════════ */
.analysis-layout { display: flex; flex-direction: column; gap: 20px; }
.input-label { display: block; font-size: 12px; color: var(--text-muted); font-weight: 600; margin-bottom: 8px; }
.analysis-textarea {
  width: 100%; min-height: 100px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px;
  color: var(--text-primary); font-size: 14px; font-family: 'Outfit', sans-serif;
  resize: vertical; transition: border-color 0.2s;
}
.analysis-textarea:focus { outline: none; border-color: var(--accent-purple); }
.analysis-textarea::placeholder { color: var(--text-muted); }

.btn-analyze {
  width: 100%; margin-top: 12px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  border: none; color: white; border-radius: 10px;
  padding: 13px; font-size: 15px; font-weight: 700;
  font-family: 'Outfit', sans-serif; cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}
.btn-analyze:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-analyze:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.analysis-result {
  min-height: 120px;
  background: var(--bg-elevated);
  border-radius: 8px; padding: 16px;
  font-size: 14px; line-height: 1.7;
  color: var(--text-secondary); white-space: pre-wrap;
}

.analysis-list { display: flex; flex-direction: column; gap: 10px; }
.analysis-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 14px;
  cursor: pointer; transition: border-color 0.2s;
}
.analysis-item:hover { border-color: var(--accent-purple); }
.analysis-item-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.analysis-item-date { font-size: 11px; color: var(--text-muted); }
.analysis-item-query { font-size: 13px; font-weight: 600; }
.analysis-item-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ══════════════════════════ 자동 투자 추천 ══════════════════════════ */
.auto-rec-card {
  background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(59,130,246,0.06));
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 16px;
  overflow: hidden;
}
.auto-rec-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(139,92,246,0.15);
}
.auto-rec-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 700; color: var(--text-primary);
}
.auto-rec-badge {
  font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: 20px; letter-spacing: 0.06em;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  color: white;
}
.auto-rec-meta {
  font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 10px;
}
.auto-rec-kis-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; padding: 2px 7px;
  border-radius: 10px;
  background: rgba(16,185,129,0.15); color: #10b981;
  border: 1px solid rgba(16,185,129,0.3);
}
.auto-rec-kis-badge.offline {
  background: rgba(107,114,128,0.15); color: #6b7280;
  border-color: rgba(107,114,128,0.3);
}
.btn-auto-recommend {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  border: none; color: white; border-radius: 10px;
  padding: 10px 18px; font-size: 14px; font-weight: 700;
  font-family: 'Outfit', sans-serif; cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
  box-shadow: 0 4px 15px rgba(139,92,246,0.3);
}
.btn-auto-recommend:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(139,92,246,0.45); }
.btn-auto-recommend:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.auto-rec-body { padding: 18px 20px; }
.auto-rec-empty {
  text-align: center; padding: 36px 20px;
  color: var(--text-muted); font-size: 14px;
}
.auto-rec-empty .empty-icon { font-size: 40px; margin-bottom: 10px; }
.auto-rec-result {
  font-size: 14px; line-height: 1.75;
  color: var(--text-secondary); white-space: pre-wrap;
}
.auto-rec-result strong { color: var(--text-primary); }
.auto-rec-sources {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.auto-rec-sources-title {
  font-size: 11px; font-weight: 700; color: var(--accent-orange);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 8px; display: flex; align-items: center; gap: 5px;
}
.auto-rec-source-chips {
  display: flex; flex-wrap: wrap; gap: 7px;
}
.source-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 4px 10px; border-radius: 20px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-secondary); text-decoration: none;
  transition: border-color 0.15s;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.source-chip:hover { border-color: var(--accent-purple); color: var(--accent-purple); }
.auto-rec-spinner {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; padding: 40px 20px;
}
.spinner-ring {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid rgba(139,92,246,0.2);
  border-top-color: #8b5cf6;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.auto-rec-spinner-text {
  font-size: 13px; color: var(--text-muted);
  text-align: center; line-height: 1.6;
}

/* ══════════════════════════ 증권사 연동 ══════════════════════════ */
.broker-coming-soon {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 60px 40px; gap: 16px;
}
.coming-soon-icon { font-size: 64px; margin-bottom: 8px; }
.broker-coming-soon h2 { font-size: 24px; font-weight: 700; }
.broker-coming-soon p { color: var(--text-secondary); max-width: 440px; line-height: 1.6; }
.broker-features { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 380px; width: 100%; }
.broker-feature {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px;
  font-size: 13px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 8px;
}
.broker-options { display: flex; gap: 16px; }
.broker-option {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-secondary);
}
.broker-logo { font-size: 32px; }

/* ══════════════════════════ MODAL ══════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  width: 480px; max-width: 95vw;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 18px; cursor: pointer; transition: color 0.2s;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body  { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row > .form-group { min-width: 0; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
  color: var(--text-primary); font-size: 14px; font-family: 'Outfit', sans-serif;
  transition: border-color 0.2s;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: var(--accent-purple);
}
.form-group select option { background: var(--bg-elevated); }

.btn-cancel {
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-secondary); border-radius: 8px;
  padding: 10px 20px; font-size: 14px; font-weight: 600;
  font-family: 'Outfit', sans-serif; cursor: pointer;
  transition: all 0.2s;
}
.btn-cancel:hover { border-color: var(--border-hover); color: var(--text-primary); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  border: none; color: white; border-radius: 8px;
  padding: 10px 24px; font-size: 14px; font-weight: 700;
  font-family: 'Outfit', sans-serif; cursor: pointer;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }

/* ══════════════════════════ TOAST ══════════════════════════ */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  border-radius: 10px; padding: 14px 20px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 500;
  animation: slide-in-toast 0.3s ease;
}
.toast.success { border-color: var(--accent-green); color: var(--accent-green); }
.toast.error   { border-color: var(--accent-red);   color: var(--accent-red); }
.toast.info    { border-color: var(--accent-purple); color: var(--accent-purple); }
@keyframes slide-in-toast {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── 자산현황 관련 추가 스타일 ── */
.month-selector-sm {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 5px 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.month-selector-sm:focus {
  border-color: var(--accent-purple);
}

.btn-secondary-sm {
  background: var(--bg-hover);
  border: 1px solid var(--border-hover);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
}
.btn-secondary-sm:hover {
  background-color: var(--bg-elevated);
  transform: translateY(-1px);
}

/* ── KIS Broker Styles ── */
.metric-card.accent-red    { border-color: rgba(239, 68, 68, 0.3); box-shadow: 0 0 20px rgba(239, 68, 68, 0.2); }
.metric-card.accent-red::before    { background: var(--accent-red); }

@media (max-width: 1024px) {
  .broker-cols {
    grid-template-columns: 1fr !important;
  }
}

/* ── AI Grounding Sources Styles ── */
.source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  transition: all 0.2s ease;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}
.source-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-link:hover {
  border-color: var(--accent-orange);
  color: var(--text-primary);
  background: rgba(245, 158, 11, 0.05);
}

@keyframes scanAnimation {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}

/* ══════════════════════════ 경제 영상 AI 요약 UI ══════════════════════════ */
/* AI 요약 텍스트 + 출처 칩을 위아래로 쌓는 블록 레이아웃
   (과거 영상 카드 그리드는 미사용 → grid 제거하여 요약 출력 깨짐 방지) */
.youtube-feed-list {
  display: block;
  width: 100%;
}

.youtube-video-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
}

.youtube-video-card:hover {
  transform: translateY(-3px);
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.youtube-video-thumbnail-wrap {
  width: 100%;
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.youtube-video-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.youtube-video-card:hover .youtube-video-thumbnail {
  transform: scale(1.04);
}

.youtube-video-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.youtube-video-channel {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  width: fit-content;
}

.youtube-video-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 38px;
}

.youtube-video-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}

.youtube-feed-spinner .spinner-ring-sm {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(139, 92, 246, 0.2);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── YouTube 채널 설정 목록 ── */
.youtube-config-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 8px;
  gap: 12px;
}

.youtube-config-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.youtube-config-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.youtube-config-id {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
}

.btn-delete-channel {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-delete-channel:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
}

/* ══════════════════════════ 반응형 미디어 쿼리 ══════════════════════════ */

/* ── 태블릿 해상도 대응 (최대 1024px) ── */
@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .filter-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ── 모바일 해상도 대응 (최대 768px) ── */
@media (max-width: 768px) {
  /* 사이드바를 모바일 드로어 형태로 토글 */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    background: var(--bg-surface);
  }
  
  .sidebar.active {
    transform: translateX(0);
  }

  /* 사이드바 숨김 해제에 따라 닫기 버튼 보이기 */
  .sidebar-close-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    margin-left: auto;
    width: 32px;
    height: 32px;
  }
  
  .sidebar-close-btn:hover {
    background: var(--bg-hover);
    color: var(--accent-purple);
  }

  /* 데스크톱 접기 버튼 숨기기 */
  .btn-sidebar-toggle {
    display: none !important;
  }

  /* 앱 레이아웃 모바일 최적화 */
  .app {
    grid-template-columns: 1fr;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow-x: hidden;
  }

  /* 모바일 상단 바 */
  .topbar {
    padding: 0 16px;
    height: 60px;
  }
  
  .sidebar-toggle-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 18px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 12px;
  }
  
  .sidebar-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--accent-purple);
  }

  .page-title {
    font-size: 18px;
  }

  /* 탭 패널 패딩 줄임 */
  .tab-panel {
    padding: 16px;
    gap: 16px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* 핵심 지표 모바일 1열 */
  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .metric-card {
    padding: 16px;
  }
  
  .metric-value {
    font-size: 22px;
  }

  /* 차트 2단에서 1단으로 */
  .chart-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .chart-card .chart-wrap {
    height: 180px;
  }

  /* 모달 레이아웃 대응 */
  .modal {
    width: 95%;
    max-width: 95%;
    border-radius: var(--radius);
  }
  
  .modal-body {
    padding: 16px 20px;
    gap: 12px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* 테이블 가로 스크롤 강화 */
  .table-wrap {
    border-radius: 8px;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .data-table th, .data-table td {
    padding: 10px;
  }

  /* 버튼 및 폼 모바일 크기 최적화 */
  .btn-primary, .btn-cancel, .btn-analyze {
    padding: 12px;
    font-size: 14px;
  }

  .form-group input, .form-group select, .form-group textarea {
    padding: 8px 10px;
    font-size: 13px;
  }

  /* 증권사 연동 모바일 레이아웃 패딩 최적화 */
  .broker-cols {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
}



