/* 데일리트레이더(daily-trader) 오너 대시보드 스타일
 * 모바일 우선(Mobile-First), 고대비 다크 테마, 콤팩트 UI, 드래그/축소 팝업
 */

:root {
  --bg-primary: #0b0f19;
  --bg-card: #131b2e;
  --bg-card-hover: #1a253e;
  --bg-input: #1a243b;
  --border-color: #233152;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-blue: #38bdf8;
  --accent-green: #34d399;
  --accent-red: #f87171;
  --accent-amber: #fbbf24;
  --accent-purple: #c084fc;
  --accent-teal: #7fd7c4;

  --badge-sample-bg: #854d0e;
  --badge-sample-text: #fef08a;

  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Pretendard", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* 유틸리티 */
.hidden {
  display: none !important;
}

.mono {
  font-family: var(--font-mono);
}

.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-amber { color: var(--accent-amber); }
.text-blue { color: var(--accent-blue); }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }

/* 샘플 배지 (SAMPLE) */
.badge-sample {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  background-color: var(--badge-sample-bg);
  color: var(--badge-sample-text);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(254, 240, 138, 0.4);
  vertical-align: middle;
}

/* 모의투자 배지 (PAPER) */
.badge-paper {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  background-color: #0369a1;
  color: #bae6fd;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(186, 230, 253, 0.4);
  vertical-align: middle;
}

/* 실전투자 배지 (LIVE) */
.badge-live {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  background-color: #15803d;
  color: #bbf7d0;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(187, 247, 208, 0.4);
  vertical-align: middle;
}

/* 상태 배지 */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
}

.status-pill.mode-paper {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.status-pill.mode-blocked {
  background: rgba(248, 113, 113, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.status-pill.state-active {
  background: rgba(52, 211, 153, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.status-pill.state-stopped {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border: 1px solid #ef4444;
}

/* 컨테이너 */
.app-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 14px 48px;
}

/* 헤더 */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 14px;
}

.brand-area h1 {
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.doctorbot-status-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-teal);
  background: rgba(127, 215, 196, 0.12);
  border: 1px solid rgba(127, 215, 196, 0.35);
  padding: 2px 7px;
  border-radius: 4px;
  margin-top: 2px;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--bg-card-hover);
  color: #fff;
}

/* ============================================================
   상단 3대 탭: [전체] [영웅문(키움)] [빗썸]
   모바일 우선, 한 손으로 누르기 쉬운 최소 44px 터치 영역
   ============================================================ */
.dash-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  background: rgba(11, 15, 25, 0.8);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.dash-tab-btn {
  flex: 1;
  min-height: 44px;
  padding: 10px 8px;
  font-size: 0.88rem;
  font-weight: 800;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.dash-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.dash-tab-btn.active {
  background: var(--accent-blue);
  color: #0b0f19;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.35);
}

/* 카드 공통 */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 그리드 */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat-box {
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid rgba(35, 49, 82, 0.6);
  border-radius: 8px;
  padding: 9px 12px;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 800;
}

.badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* 잔고 히어로 */
.balance-hero {
  text-align: center;
  padding: 10px 0 8px;
  border-bottom: 1px dashed var(--border-color);
  margin-bottom: 10px;
}

.balance-total-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.balance-total-val {
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 2px 0;
}

.balance-pnl-val {
  font-size: 0.82rem;
  font-weight: 700;
}

.holdings-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.holding-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(11, 15, 25, 0.4);
  border: 1px solid rgba(35, 49, 82, 0.4);
  font-size: 0.8rem;
}

/* 성과 탭 */
.perf-tabs {
  display: flex;
  gap: 3px;
  background: var(--bg-primary);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.perf-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
}

.perf-tab-btn.active {
  background: var(--bg-card);
  color: #fff;
}

.perf-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}

/* 미체결 접이식 */
.btn-toggle-sm {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.collapsed-notice-bar {
  background: rgba(11, 15, 25, 0.5);
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.unexecuted-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.unexecuted-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid rgba(35, 49, 82, 0.4);
  border-radius: 6px;
  font-size: 0.75rem;
}

/* 주문 카드 */
.order-card {
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;
}

.order-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.order-main-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.order-symbol {
  font-size: 0.95rem;
  font-weight: 800;
}

.order-price {
  font-size: 0.88rem;
  font-weight: 700;
}

.order-meta-info {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 10px;
}

.order-btn-group {
  display: flex;
  gap: 8px;
}

.btn-order {
  flex: 1;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-approve {
  background: var(--accent-green);
  color: #06201c;
}
.btn-approve:hover { filter: brightness(1.1); }

.btn-reject {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.btn-reject:hover { background: rgba(248, 113, 113, 0.15); color: var(--accent-red); }

/* 체결 기록 */
.trade-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trade-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: rgba(11, 15, 25, 0.4);
  border: 1px solid rgba(35, 49, 82, 0.4);
  border-radius: 8px;
  font-size: 0.78rem;
}

/* 관문 진행바 */
.gate-item {
  margin-bottom: 12px;
}
.gate-item:last-child { margin-bottom: 0; }

.gate-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 3px;
}

.gate-progress-wrap {
  width: 100%;
  height: 6px;
  background: rgba(11, 15, 25, 0.8);
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid rgba(35, 49, 82, 0.5);
}

.gate-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #34d399);
  border-radius: 9999px;
}
.gate-progress-fill.passed { background: #34d399; }

.gate-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 긴급정지 */
.killswitch-wrap {
  margin: 16px 0 8px;
}

.btn-killswitch {
  width: 100%;
  min-height: 48px;
  padding: 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ef4444, #dc2626);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
  border: 1px solid #b91c1c;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-killswitch:hover { background: #b91c1c; }
.btn-killswitch.stopped {
  background: linear-gradient(180deg, #34d399, #059669);
  border-color: #047857;
}

/* 경고 */
.alert-box {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
}

.alert-box.warning {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fef08a;
}

.alert-box.info {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #e0f2fe;
}

/* ============================================================
   공개 소개 페이지 (Intro View - B안)
   ============================================================ */
.intro-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 85vh;
  padding: 24px 16px;
}

.intro-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.intro-logo-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: rgba(56, 189, 248, 0.1);
  border: 2px solid rgba(56, 189, 248, 0.3);
  border-radius: 14px;
  margin-bottom: 16px;
}

.logo-symbol {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent-blue);
}

.intro-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 10px;
}

.intro-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 20px;
}

.intro-topics {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  background: rgba(11, 15, 25, 0.5);
  border: 1px solid rgba(35, 49, 82, 0.5);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 20px;
}

.topic-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.78rem;
}

.topic-bullet {
  color: var(--accent-blue);
}

.intro-warning {
  font-size: 0.72rem;
  color: var(--accent-amber);
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 6px;
  padding: 8px 12px;
  line-height: 1.4;
  text-align: left;
  margin-bottom: 16px;
}

.intro-footer {
  font-size: 0.7rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

/* ============================================================
   초소형 개발자 점 (박사봇 개발자 모드 점 UI 스타일)
   ============================================================ */
.dev-toggle {
  position: fixed;
  bottom: 14px;
  right: 14px;
  width: 10px;
  height: 10px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #64748b;
  opacity: 0.25;
  cursor: pointer;
  z-index: 999;
  transition: opacity 0.2s, transform 0.1s;
}

.dev-toggle:hover {
  opacity: 0.75;
  transform: scale(1.3);
}

/* 개발자 인증 작은 패널 */
.dev-auth-panel {
  position: fixed;
  bottom: 30px;
  right: 14px;
  width: 290px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.dev-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.dev-panel-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.btn-close-sm {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px 6px;
}

.btn-close-sm:hover { color: #fff; }

.dev-step-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.dev-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  outline: none;
}
.dev-input:focus { border-color: var(--accent-blue); }

.btn-google-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px;
  background: #fff;
  color: #1f2937;
  border: none;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-sm-primary {
  background: var(--accent-blue);
  color: #0b0f19;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  position: relative;
}
/* 모바일 44px 터치 영역 보장 */
.btn-sm-primary::before, .btn-sm-secondary::before {
  content: "";
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: -4px;
  right: -4px;
}

.btn-sm-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  position: relative;
  padding: 8px 12px;
}

.dev-attempt-info {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: right;
}

.dev-error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 0.72rem;
  padding: 6px 8px;
  border-radius: 4px;
  margin-top: 8px;
  line-height: 1.35;
}

/* 스텔스 404 */
.stealth-404-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 85vh;
  text-align: center;
  padding: 24px;
}

.stealth-404-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 40px 32px;
  max-width: 360px;
  width: 100%;
}

.stealth-404-box h1 {
  font-size: 3rem;
  font-weight: 900;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stealth-404-box p {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* ============================================================
   매매 승인 드래그/축소 팝업 (오너 피드백 적용)
   ============================================================ */
.draggable-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 310px;
  max-width: calc(100vw - 32px);
  background: var(--bg-card);
  border: 1px solid var(--accent-amber);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  overflow: hidden;
  user-select: none;
}

.draggable-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(26, 37, 62, 0.95);
  padding: 8px 12px;
  cursor: grab;
  touch-action: none;
  border-bottom: 1px solid var(--border-color);
}
.draggable-header:active { cursor: grabbing; }

.draggable-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.draggable-controls {
  display: flex;
  gap: 2px;
}

.btn-popup-tool {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 6px;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  border-radius: 4px;
}
.btn-popup-tool:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.draggable-body {
  padding: 12px;
}

.popup-subtext {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
}

.popup-order-summary {
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid rgba(35, 49, 82, 0.6);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.72rem;
  line-height: 1.4;
}

.popup-btn-row {
  display: flex;
  gap: 8px;
}
.popup-btn-row .btn-sm-primary, .popup-btn-row .btn-sm-secondary {
  flex: 1;
  padding: 8px 10px;
}

.popup-note {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.35;
}

/* 접힌 하단 플로팅 바 */
.minimized-trade-bar {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: var(--bg-card);
  border: 1px solid var(--accent-amber);
  color: #fff;
  padding: 8px 14px;
  border-radius: 9999px;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  z-index: 998;
}

.pulse-indicator {
  color: var(--accent-amber);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.minimized-badge {
  background: var(--accent-red);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 9999px;
}

/* 토스트 */
.toast-msg {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--border-color);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  pointer-events: none;
  transition: opacity 0.3s;
}
