/* ============================================================
   SIGNAL — AI Stock Analysis
   style.css
   ============================================================ */

:root {
  --bg: #080c10;
  --s1: #0d1219;
  --s2: #131b24;
  --s3: #1a2433;
  --border: rgba(255,255,255,0.06);
  --border2: rgba(255,255,255,0.12);
  --green: #00d68f;
  --green-dim: rgba(0,214,143,0.12);
  --red: #ff4d6a;
  --red-dim: rgba(255,77,106,0.12);
  --amber: #ffb020;
  --amber-dim: rgba(255,176,32,0.12);
  --blue: #4d9fff;
  --blue-dim: rgba(77,159,255,0.1);
  --text: #e8edf2;
  --muted: rgba(232,237,242,0.4);
  --faint: rgba(232,237,242,0.15);
  --mono: 'DM Mono', 'Noto Sans KR', sans-serif;
  --sans: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scanline texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   HEADER
   ============================================================ */
.hdr {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8,12,16,0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 3px;
  color: var(--green);
}

.logo span {
  color: var(--muted);
  font-size: 12px;
  margin-left: 6px;
  letter-spacing: 1px;
}

.hdr-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--green);
  border: 1px solid rgba(0,214,143,0.25);
  border-radius: 20px;
  padding: 4px 10px;
  letter-spacing: 1px;
}

.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.3; transform: scale(0.7); }
}

.notif-btn {
  background: none;
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

.notif-btn:hover {
  border-color: var(--green);
  background: var(--green-dim);
}

.time-display {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--s1);
  overflow-x: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar { display: none; }

.nav-item {
  flex: 1;
  min-width: 80px;
  padding: 12px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.5px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-item.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

/* ============================================================
   SEARCH
   ============================================================ */
.search-section {
  padding: 14px 16px;
  background: var(--s1);
  border-bottom: 1px solid var(--border);
}

.search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.search-input {
  flex: 1;
  background: var(--s2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus { border-color: var(--green); }
.search-input::placeholder { color: var(--faint); }

.go-btn {
  background: var(--green);
  color: #000;
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.go-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: var(--s2);
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  letter-spacing: 0.5px;
  transition: all 0.15s;
}

.chip:hover {
  border-color: var(--green);
  color: var(--green);
}

/* ============================================================
   STATS BAR
   ============================================================ */
.stats-bar {
  display: none;
  grid-template-columns: repeat(4,1fr);
  gap: 1px;
  background: var(--border);
  margin: 12px 16px;
  border-radius: 12px;
  overflow: hidden;
}

.stat {
  background: var(--s1);
  padding: 12px 10px;
  text-align: center;
}

.stat-n {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
}

.stat-l {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.5px;
}

/* ============================================================
   SECTION / EMPTY
   ============================================================ */
.section { padding: 0 16px; }

.empty {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 40px;
  opacity: 0.2;
  margin-bottom: 12px;
}

.empty-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress {
  height: 1px;
  background: var(--border);
  margin: 0 16px 12px;
  border-radius: 1px;
  overflow: hidden;
  display: none;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 1px;
  animation: prog 2s ease-in-out infinite;
}

@keyframes prog {
  0%   { width: 0; margin-left: 0; }
  50%  { width: 50%; margin-left: 25%; }
  100% { width: 0; margin-left: 100%; }
}

/* ============================================================
   CARDS
   ============================================================ */
.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 24px;
}

.card {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.2s;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.card.buy   { border-left: 2px solid var(--green); }
.card.sell  { border-left: 2px solid var(--red); }
.card.watch { border-left: 2px solid var(--amber); }
.card.hold  { border-left: 2px solid var(--faint); }

.card-head { padding: 14px 14px 14px; }

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.card-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.card-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.15s;
  flex-shrink: 0;
}
.card-close-btn:hover { color: var(--red); }

.sname { font-size: 15px; font-weight: 600; }

.sticker {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 1px;
}

.badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 1px;
}

.badge.buy   { background: var(--green-dim); color: var(--green); }
.badge.sell  { background: var(--red-dim);   color: var(--red); }
.badge.watch { background: var(--amber-dim); color: var(--amber); }
.badge.hold  { background: rgba(255,255,255,0.05); color: var(--muted); }

/* Price */
.price-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.price-main {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
}

.price-chg {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}

.price-chg.up { color: var(--green); }
.price-chg.dn { color: var(--red); }

.target-row {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.target-row span { color: var(--text); font-weight: 500; }

/* Indicator pills */
.indicators {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.ind {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  color: var(--muted);
}

.ind.bull { border-color: rgba(0,214,143,0.3);  color: var(--green); background: var(--green-dim); }
.ind.bear { border-color: rgba(255,77,106,0.3);  color: var(--red);   background: var(--red-dim); }
.ind.neu  { border-color: rgba(255,176,32,0.3);  color: var(--amber); background: var(--amber-dim); }

/* Reasons */
.reasons { margin-bottom: 10px; }

.reason-item {
  font-size: 12px;
  color: var(--muted);
  padding: 2px 0;
  line-height: 1.5;
}

.reason-item::before { content: '·  '; color: var(--faint); }

/* Analysis box */
.analysis-box {
  background: var(--s2);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: rgba(232,237,242,0.65);
  line-height: 1.7;
  border-left: 2px solid var(--border2);
}

/* Metrics grid */
.metrics {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 6px;
  margin: 10px 0;
}

.met { background: var(--s2); border-radius: 8px; padding: 8px; }

.met-l {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.met-v { font-family: var(--mono); font-size: 12px; }

/* Sparkline */
.spark-wrap { padding: 0 14px 12px; }
.chart-wrap {
  margin: 10px -16px 4px;
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.spark-label {
  font-size: 10px;
  color: var(--faint);
  margin-bottom: 4px;
  font-family: var(--mono);
  letter-spacing: 1px;
}

/* Card footer */
.card-foot {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.foot-left {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
  letter-spacing: 0.5px;
}

.conf-bar { display: flex; align-items: center; gap: 6px; }

.conf-track {
  width: 60px;
  height: 3px;
  background: var(--border2);
  border-radius: 2px;
  overflow: hidden;
}

.conf-fill { height: 100%; border-radius: 2px; }
.conf-val  { font-family: var(--mono); font-size: 10px; color: var(--muted); }

/* Skeleton loading */
.skel {
  background: var(--s2);
  border-radius: 6px;
  animation: skel 1.5s infinite;
}

@keyframes skel {
  0%,100% { opacity: 0.4; }
  50%      { opacity: 0.7; }
}

/* ============================================================
   TAB SYSTEM
   ============================================================ */
.tab-content { display: none; }
.tab-content.on { display: block; }

/* ============================================================
   WATCHLIST TAB
   ============================================================ */
.wl-section { padding: 14px 16px; }

.wl-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.wl-add-row input {
  flex: 1;
  background: var(--s2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.wl-add-row input:focus { border-color: var(--blue); }

.wl-add-btn {
  background: var(--s2);
  border: 1px solid var(--blue);
  color: var(--blue);
  border-radius: 10px;
  padding: 10px 16px;
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.wl-add-btn:hover { background: var(--blue-dim); }

.wl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.wl-card {
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  position: relative;
  transition: border-color 0.2s;
}
.wl-card.buy  { border-color: rgba(0,214,143,0.35); }
.wl-card.sell { border-color: rgba(255,77,106,0.35); }
.wl-card.watch{ border-color: rgba(255,176,32,0.35); }

.wl-card-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.wl-del {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
  transition: color 0.15s;
}
.wl-del:hover { color: var(--red); }

.wl-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }

.wl-tick {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.wl-signal-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--blue);
  margin-bottom: 3px;
}
.wl-conf { color: var(--muted); }
.wl-time {
  font-size: 10px;
  color: var(--faint);
  margin-bottom: 8px;
}

.wl-go {
  width: 100%;
  padding: 7px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 7px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.wl-go:hover { border-color: var(--green); color: var(--green); }

.scan-all-btn {
  width: 100%;
  padding: 16px;
  background: var(--s2);
  border: 1px solid var(--green);
  border-radius: 12px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.scan-all-btn:hover { background: var(--green-dim); }

.scan-all-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  border-color: var(--border);
  color: var(--muted);
}

.scan-all-btn:disabled:hover { background: var(--s2); }

/* ============================================================
   ALERTS TAB
   ============================================================ */
.alert-subtabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.alert-subtab {
  flex: 1;
  text-align: center;
  padding: 12px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.alert-subtab.active {
  color: var(--text);
  border-bottom-color: var(--green);
  font-weight: 600;
}

.alert-list {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-card {
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.alert-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.alert-name { font-size: 13px; font-weight: 600; }
.alert-time { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.alert-body { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ============================================================
   SETTINGS TAB
   ============================================================ */
.settings { padding: 16px; }

/* ── 프로필 카드 ── */
.profile-card {
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 20px;
}
.profile-login-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  font-size: 13px;
  color: var(--muted);
}
.profile-login-btn {
  background: var(--green);
  border: none;
  border-radius: 8px;
  color: #000;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 16px;
  cursor: pointer;
}
.profile-main {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.profile-main:hover { background: var(--s3); }
.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 0; }
.profile-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-email {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-logout {
  background: var(--s3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.profile-logout:hover { border-color: var(--red); color: var(--red); }
.profile-edit-section {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.profile-edit-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.profile-edit-row { display: flex; gap: 8px; }
.profile-edit-input {
  flex: 1;
  background: var(--s3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  padding: 7px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.profile-edit-input:focus { border-color: var(--green); }
.profile-edit-save {
  background: var(--green);
  border: none;
  border-radius: 8px;
  color: #000;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 16px;
  cursor: pointer;
}
.profile-colors {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.profile-color-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s;
  border: 2px solid transparent;
}
.profile-color-dot:hover { transform: scale(1.2); }
.profile-color-dot.active {
  border-color: #fff;
  transform: scale(1.15);
}
.profile-photo-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--s3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.profile-photo-btn:hover { border-color: var(--green); color: var(--green); }
.profile-photo-remove {
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.profile-photo-remove:hover { border-color: var(--red); color: var(--red); }

.setting-group { margin-bottom: 20px; }

.setting-title {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--s2);
  border-radius: 10px;
  margin-bottom: 6px;
  font-size: 13px;
}

.setting-val {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--blue);
}

.setting-select {
  background: var(--s2);
  border: 1px solid var(--border2);
  color: var(--blue);
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  .live-pill { display: none; }
  #db-status  { display: none; }
  #clock      { display: none; }
}

@media (min-width: 600px) {
  .cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .wl-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* 데스크탑: empty state 뷰포트 정중앙 고정 */
  #tab-analyze .empty {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-height: unset;
    padding: 20px;
    width: max-content;
    max-width: 360px;
    z-index: 1;
  }
}


/* ============================================================
   AUTH
   ============================================================ */
.auth-btn {
  padding: 5px 12px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-btn:hover { color: var(--text); border-color: var(--text); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-box {
  background: var(--s2);
  border: 1px solid var(--border2);
  border-radius: 18px;
  width: 100%;
  max-width: 380px;
  overflow: hidden;
}
.modal-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 15px;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
}
.modal-body { padding: 20px 18px; }

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--s1);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 18px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.auth-tab.active { background: var(--s3); color: var(--text); font-weight: 500; }

.oauth-btns { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px; border-radius: 10px; font-size: 14px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--border2); transition: opacity 0.2s;
  width: 100%;
}
.oauth-btn:hover { opacity: 0.85; }
.oauth-btn.google { background: #fff; color: #333; }

.oauth-divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 12px; margin: 12px 0 4px;
}
.oauth-divider::before, .oauth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-input {
  background: var(--s1);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.auth-input:focus { border-color: var(--blue); }
.auth-err {
  font-size: 12px;
  color: var(--red);
  min-height: 16px;
  text-align: center;
}
.auth-submit {
  padding: 13px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-top: 4px;
}
.auth-submit:hover { opacity: 0.85; }
.auth-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   주가 지표 그리드 + 분석 섹션
   ============================================================ */
.price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 10px 0;
}
.pg-item {
  background: var(--s1);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pg-l { font-size: 11px; color: var(--muted); }
.pg-v { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.pg-v.up { color: var(--green); }
.pg-v.dn { color: var(--red); }

.analysis-section { margin-top: 10px; }
.analysis-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.catalyst-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.9;
}
.catalyst-list li { color: var(--blue); }
.catalyst-list li::marker { color: var(--blue); }

/* ============================================================
   카드 상세 힌트 줄
   ============================================================ */
.card-detail-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--faint);
  padding: 6px 14px 10px;
  letter-spacing: 0.3px;
  border-top: 1px solid var(--border);
}
.wl-add-card-btn {
  background: var(--green-dim);
  border: 1px solid var(--green);
  border-radius: 20px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.wl-add-card-btn:hover {
  background: var(--green);
  color: #000;
}
.wl-add-card-btn:disabled {
  background: transparent;
  border-color: var(--border2);
  color: var(--faint);
  cursor: default;
}

/* ============================================================
   상세 분석 모달
   ============================================================ */
.detail-box {
  background: var(--s1);
  border: 1px solid var(--border2);
  border-radius: 18px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

.detail-hdr {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.detail-hdr-info { flex: 1; min-width: 0; }

.detail-name {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.detail-ticker-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
}

/* 탭 바 */
.detail-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--s1);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.detail-tabs::-webkit-scrollbar { display: none; }

.detail-tab {
  flex: 1;
  min-width: 64px;
  text-align: center;
  padding: 11px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.detail-tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

/* 내용 영역 */
.detail-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

.detail-body::-webkit-scrollbar { width: 4px; }
.detail-body::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.detail-content { padding: 14px 16px 24px; }

/* 로딩 / 오류 / 빈 상태 */
.detail-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 13px;
}

.detail-spin {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.detail-error {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}
.detail-error small { font-size: 11px; color: var(--faint); }

.detail-empty {
  text-align: center;
  padding: 50px 20px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}
.detail-empty small { font-size: 11px; color: var(--faint); }

/* ── 뉴스 ── */
.news-item {
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.news-item:hover { border-color: var(--border2); }

.news-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.news-source {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--blue);
  background: var(--blue-dim);
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.news-date {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
}

.news-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 8px;
  color: var(--text);
}

.news-summary {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 10px;
}

.news-link {
  display: inline-block;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--green);
  text-decoration: none;
  letter-spacing: 0.3px;
  transition: opacity 0.15s;
}
.news-link:hover { opacity: 0.7; }

.news-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}

.news-month-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 2px 4px;
  border-bottom: 1px solid var(--border);
  margin: 14px 0 8px;
}
.news-month-header:first-child { margin-top: 0; }

.news-more-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  background: var(--s2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.news-more-btn:hover {
  border-color: var(--blue);
  color: var(--text);
}

/* ── 재무재표 · 펀더멘탈 공통 ── */
.fin-section { margin-bottom: 20px; }

.fin-title {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* 테이블 (손익계산서) */
.fin-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.fin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 400px;
}

.fin-table th {
  text-align: right;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-weight: 500;
}

.fin-table th:first-child { text-align: left; }

.fin-table td {
  text-align: right;
  padding: 9px 10px;
  font-family: var(--mono);
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.fin-table td:first-child {
  text-align: left;
  color: var(--muted);
  font-size: 12px;
}

.fin-table tr:last-child td { border-bottom: none; }
.fin-table .fin-empty { text-align: center; color: var(--faint); padding: 20px; }
.fin-table .up { color: var(--green); }
.fin-table .dn { color: var(--red); }

/* 그리드 (대차대조표 · 현금흐름) */
.fin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.fin-item {
  background: var(--s2);
  border-radius: 9px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.fin-l {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 0;
}

.fin-v {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  text-align: right;
}
.fin-v.up { color: var(--green); }
.fin-v.dn { color: var(--red); }

/* 펀더멘탈 그리드 */
.fund-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.fund-item {
  background: var(--s2);
  border-radius: 9px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.fund-l {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 0;
}

.fund-v {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  text-align: right;
}
.fund-v.up { color: var(--green); }
.fund-v.dn { color: var(--red); }

@media (max-width: 400px) {
  .fin-grid, .fund-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   투자 경고 배너 (매 세션 1회)
   ============================================================ */
#warn-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: rgba(247, 201, 72, 0.12);
  border-top: 1px solid rgba(247, 201, 72, 0.4);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text);
  backdrop-filter: blur(8px);
}
#warn-banner span { flex: 1; line-height: 1.5; }
#warn-banner button {
  background: rgba(247, 201, 72, 0.2);
  border: 1px solid rgba(247, 201, 72, 0.5);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
#warn-banner button:hover { background: rgba(247, 201, 72, 0.35); }

/* ============================================================
   최초 1회 면책 동의 모달
   ============================================================ */
.disc-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.disc-overlay.hidden { display: none; }

.disc-box {
  background: var(--s1);
  border: 1px solid var(--border2);
  border-radius: 18px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

.disc-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  padding: 20px 20px 4px;
  text-align: center;
}
.disc-sub {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 0 20px 14px;
}

.disc-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 8px;
  min-height: 0;
  overscroll-behavior: contain;
}
.disc-scroll::-webkit-scrollbar { width: 4px; }
.disc-scroll::-webkit-scrollbar-track { background: transparent; }
.disc-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

.disc-content {
  background: var(--s2);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.disc-content p {
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  margin: 0 0 10px;
  padding-left: 14px;
  position: relative;
}
.disc-content p::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--amber);
}
.disc-content p:last-child { margin-bottom: 0; }

.disc-checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 4px;
}

.disc-check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--s2);
  transition: border-color 0.15s;
}
.disc-check-item:has(.disc-cb:checked) { border-color: var(--green); }
.disc-check-item:has(.disc-cb:disabled) { opacity: 0.5; cursor: default; }

.disc-cb {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  accent-color: var(--green);
  cursor: pointer;
}
.disc-cb:disabled { cursor: not-allowed; }

.disc-check-item span {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.disc-hint {
  font-size: 12px;
  color: var(--amber);
  text-align: center;
  padding: 10px 20px 6px;
  transition: opacity 0.3s;
}

.disc-btn {
  margin: 10px 20px 20px;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: var(--green);
  color: #000;
  transition: opacity 0.2s;
}
.disc-btn:disabled {
  background: var(--s3);
  color: var(--muted);
  cursor: not-allowed;
}

/* ─── 심화분석 탭 헤더 ─── */
.deep-tab-hdr {
  display: flex;
  flex-direction: column;
  padding: 16px 16px 0;
  border-bottom: 1px solid var(--border2);
  margin-bottom: 4px;
}
.deep-tab-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.deep-tab-ticker {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  padding-bottom: 12px;
}
.deep-tab-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  gap: 12px;
}

/* ─── 심화 분석 탭 ─── */
.deep-chart-wrap {
  position: relative;
  width: 100%;
  background: var(--s2);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 4px;
}

#deep-chart-canvas {
  display: block;
  width: 100%;
  cursor: crosshair;
}

.deep-tooltip {
  position: absolute;
  background: rgba(12,20,30,0.93);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 8px 11px;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  z-index: 20;
  min-width: 130px;
}

.deep-tt-date {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 3px;
  font-family: 'DM Mono', monospace;
}

.deep-tt-price {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  font-family: 'DM Mono', monospace;
}

.deep-tt-chg {
  font-size: 12px;
  font-family: 'DM Mono', monospace;
}
.deep-tt-chg.up { color: var(--green); }
.deep-tt-chg.dn { color: var(--red); }

.deep-section {
  margin: 20px 0 4px;
}

.deep-sec-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.deep-sec-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 10px;
}
.deep-sec-hdr .deep-sec-title { margin-bottom: 0; }

.deep-filters {
  display: flex;
  gap: 5px;
}

.deep-filter-btn {
  background: var(--s3);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.deep-filter-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.deep-filter-btn:hover:not(.active) {
  border-color: var(--blue);
  color: var(--text);
}

.deep-no-data {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.news-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.news-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background: var(--s2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.news-page-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.news-page-btn:hover:not(.active):not(:disabled) {
  border-color: var(--blue);
  color: var(--text);
}
.news-page-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.news-page-ellipsis {
  color: var(--muted);
  font-size: 12px;
  padding: 0 4px;
}
