/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f1117; color: #e2e8f0; font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }

/* ===== Navbar ===== */
.navbar { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; height: 52px; background: #161b22; border-bottom: 1px solid #30363d; position: sticky; top: 0; z-index: 200; }
.navbar-brand { font-size: 16px; font-weight: 700; color: #58a6ff; text-decoration: none; transition: opacity 0.15s; }
.navbar-brand:hover { opacity: 0.8; }

/* ===== Navbar Right ===== */
.navbar-right { display: flex; align-items: center; gap: 4px; }
.navbar-refresh { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; background: none; border: none; color: #8b949e; font-size: 26px; cursor: pointer; border-radius: 8px; transition: all 0.2s; line-height: 1; }
.navbar-refresh:hover { background: #21262d; color: #e2e8f0; }
.navbar-refresh:active { transform: rotate(180deg); color: #58a6ff; }

/* ===== Hamburger ===== */
.hamburger { display: flex; flex-direction: column; justify-content: center; gap: 5px; width: 36px; height: 36px; background: none; border: none; cursor: pointer; padding: 4px; border-radius: 8px; transition: background 0.15s; }
.hamburger:hover { background: #21262d; }
.hamburger span { display: block; height: 2px; background: #c9d1d9; border-radius: 2px; transition: transform 0.25s, opacity 0.25s, width 0.25s; transform-origin: center; }
.hamburger span:nth-child(3) { width: 65%; }
/* X 애니메이션 */
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { width: 100%; transform: translateY(-7px) rotate(-45deg); }

/* ===== Drawer ===== */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0); pointer-events: none; z-index: 300; transition: background 0.3s; }
.drawer-overlay.open { background: rgba(0,0,0,0.6); pointer-events: all; }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 280px; background: #161b22; border-left: 1px solid #30363d; z-index: 400; display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4,0,0.2,1); }
.drawer.open { transform: translateX(0); }

.drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; height: 52px; border-bottom: 1px solid #21262d; flex-shrink: 0; }
.drawer-title { font-size: 16px; font-weight: 700; color: #58a6ff; }
.drawer-close { background: none; border: none; color: #8b949e; font-size: 18px; cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; transition: all 0.15s; }
.drawer-close:hover { background: #21262d; color: #e2e8f0; }

.drawer-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.drawer-item { display: flex; align-items: center; gap: 14px; padding: 13px 20px; color: #8b949e; text-decoration: none; font-size: 15px; font-weight: 500; transition: all 0.15s; border-left: 3px solid transparent; }
.drawer-item:hover { background: #1c2128; color: #e2e8f0; }
.drawer-item.active { background: #1c2128; color: #58a6ff; border-left-color: #58a6ff; }
.drawer-item-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }

.drawer-footer { padding: 16px 20px; border-top: 1px solid #21262d; flex-shrink: 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.drawer-logout { display: block; padding: 11px 16px; border-radius: 8px; color: #f85149; font-size: 14px; font-weight: 500; text-decoration: none; text-align: center; border: 1px solid rgba(248,81,73,0.3); transition: all 0.15s; }
.drawer-logout:hover { background: rgba(248,81,73,0.1); }

/* ===== Container ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }

/* ===== Toast ===== */
#toast-container { position: fixed; top: 62px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; border-radius: 12px; min-width: 260px; max-width: 360px; border: 1px solid; pointer-events: all; opacity: 0; transform: translateX(20px); transition: opacity 0.28s, transform 0.28s; box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { background: #0d1f14; border-color: #238636; }
.toast-error   { background: #1f0d0d; border-color: #f85149; }
.toast-warning { background: #1f1a0d; border-color: #d29922; }
.toast-info    { background: #0d1421; border-color: #1f6feb; }
.toast-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-msg { flex: 1; font-size: 13px; line-height: 1.5; color: #e2e8f0; white-space: pre-line; }
.toast-close { background: none; border: none; color: #8b949e; font-size: 13px; cursor: pointer; padding: 0; flex-shrink: 0; margin-top: 1px; transition: color 0.15s; }
.toast-close:hover { color: #e2e8f0; }
@media (max-width: 640px) {
  #toast-container { left: 12px; right: 12px; }
  .toast { min-width: unset; max-width: 100%; }
}

/* ===== Alert ===== */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.alert-danger { background: #2d1c1c; border-color: #f85149; color: #f85149; }
.alert-warning { background: #2d2515; border-color: #d29922; color: #d29922; }
.alert-success { background: #1c2d1c; border-color: #3fb950; color: #3fb950; }

/* ===== Form Check ===== */
.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: #58a6ff; }
.form-check label { color: #8b949e; font-size: 13px; cursor: pointer; }

/* ===== Login ===== */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 52px); }
.login-box { background: #161b22; border: 1px solid #30363d; border-radius: 12px; padding: 40px; width: 100%; max-width: 400px; }
.login-title { font-size: 28px; font-weight: 700; color: #58a6ff; text-align: center; margin-bottom: 8px; }
.login-subtitle { text-align: center; color: #8b949e; margin-bottom: 32px; }

/* ===== Card ===== */
.card { background: #161b22; border: 1px solid #30363d; border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.card-title { font-size: 16px; font-weight: 600; color: #c9d1d9; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #21262d; }

/* ===== Page Header ===== */
.page-header { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; }
.page-header h2 { font-size: 20px; font-weight: 600; }
.page-header-sub { font-size: 12px; color: #58a6ff; margin-right: auto; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: #8b949e; margin-bottom: 6px; font-weight: 500; }
.form-control { width: 100%; padding: 9px 12px; background: #0d1117; border: 1px solid #30363d; border-radius: 6px; color: #e2e8f0; font-size: 14px; transition: border-color 0.15s; outline: none; }
.form-control:focus { border-color: #58a6ff; }
.form-control::placeholder { color: #484f58; }
.input-row { display: flex; gap: 8px; }
.input-row .form-control { flex: 1; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; border-radius: 6px; border: 1px solid transparent; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.btn-primary { background: #238636; border-color: #2ea043; color: #fff; }
.btn-primary:hover { background: #2ea043; }
.btn-secondary { background: #21262d; border-color: #30363d; color: #c9d1d9; }
.btn-secondary:hover { background: #30363d; }
.btn-buy { background: #c0392b; border-color: #e74c3c; color: #fff; }
.btn-buy:hover, .btn-buy.active { background: #e74c3c; }
.btn-sell { background: #1565c0; border-color: #1976d2; color: #fff; }
.btn-sell:hover { background: #1976d2; }
.btn-danger { background: transparent; border-color: #f85149; color: #f85149; }
.btn-danger:hover { background: #f8514920; }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; }

/* ===== Home ===== */
.home-wrap { display: flex; flex-direction: column; gap: 20px; max-width: 720px; margin: 0 auto; }

/* Hero Card */
.hero-card {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0d1f36 0%, #0f1117 50%, #1a0d2e 100%);
  border: 1px solid #1f3a5f;
  border-radius: 20px;
  padding: 32px 28px 28px;
}
.hero-card::before {
  content: '';
  position: absolute; top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(88,166,255,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.hero-card::after {
  content: '';
  position: absolute; bottom: -40px; left: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(121,192,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.hero-label { font-size: 12px; color: #8b949e; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px; }
.hero-amount { font-size: 36px; font-weight: 800; color: #e2e8f0; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.hero-loading { font-size: 16px; font-weight: 400; color: #484f58; animation: pulse 1.5s ease-in-out infinite; }
.hero-sub { font-size: 15px; font-weight: 600; margin-bottom: 24px; min-height: 22px; }
.hero-up { color: #f85149; }
.hero-down { color: #58a6ff; }
.hero-stats { display: flex; align-items: center; gap: 0; background: rgba(255,255,255,0.04); border-radius: 12px; padding: 14px 0; }
.hero-stat { flex: 1; text-align: center; }
.hero-stat-label { font-size: 11px; color: #8b949e; margin-bottom: 5px; }
.hero-stat-value { font-size: 14px; font-weight: 600; color: #c9d1d9; font-variant-numeric: tabular-nums; }
.hero-stat-divider { width: 1px; height: 32px; background: #21262d; }

/* Quick Grid */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 20px 10px;
  background: #161b22; border: 1px solid #30363d;
  border-radius: 16px; text-decoration: none;
  transition: all 0.18s; cursor: pointer;
}
.quick-card:hover { transform: translateY(-3px); border-color: #58a6ff; background: #1c2128; }
.quick-icon { font-size: 26px; line-height: 1; }
.quick-label { font-size: 13px; font-weight: 600; color: #c9d1d9; }
.quick-desc { font-size: 11px; color: #484f58; }
.quick-order:hover  { border-color: #e74c3c; box-shadow: 0 0 16px rgba(231,76,60,0.15); }
.quick-watch:hover  { border-color: #d29922; box-shadow: 0 0 16px rgba(210,153,34,0.15); }
.quick-balance:hover{ border-color: #3fb950; box-shadow: 0 0 16px rgba(63,185,80,0.15); }
.quick-auto:hover   { border-color: #79c0ff; box-shadow: 0 0 16px rgba(121,192,255,0.15); }

/* Home Section */
.home-section { background: #161b22; border: 1px solid #30363d; border-radius: 16px; overflow: hidden; }
.home-section-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #21262d; }
.home-section-title { font-size: 14px; font-weight: 600; color: #c9d1d9; }
.home-section-more { font-size: 12px; color: #58a6ff; }
.home-section-more:hover { text-decoration: underline; }
.home-empty { padding: 32px; text-align: center; color: #484f58; font-size: 13px; }

/* ── 토큰 상태 카드 ── */
.token-status-card { padding: 14px 20px; display: flex; flex-direction: column; gap: 6px; }
.token-status-row { display: flex; align-items: center; gap: 8px; }
.token-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.token-valid .token-dot   { background: #3fb950; box-shadow: 0 0 6px #3fb950; }
.token-expired .token-dot { background: #f85149; box-shadow: 0 0 6px #f85149; }
.token-none .token-dot    { background: #484f58; }
.token-label { font-size: 13px; font-weight: 600; }
.token-valid .token-label   { color: #3fb950; }
.token-expired .token-label { color: #f85149; }
.token-none .token-label    { color: #484f58; }
.token-expires { margin-left: auto; font-size: 12px; color: #8b949e; }
.token-meta { font-size: 12px; color: #484f58; padding-left: 16px; }

/* Recent Orders */
.recent-list { display: flex; flex-direction: column; }
.recent-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid #21262d; transition: background 0.1s; }
.recent-item:last-child { border-bottom: none; }
.recent-item:hover { background: #1c2128; }
.recent-left { display: flex; align-items: center; gap: 12px; }
.recent-badge { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.rbadge-buy  { background: rgba(231,76,60,0.15); color: #e74c3c; }
.rbadge-sell { background: rgba(25,118,210,0.15); color: #1976d2; }
.recent-name { font-size: 14px; font-weight: 500; color: #c9d1d9; margin-bottom: 2px; }
.recent-meta { font-size: 11px; color: #484f58; }
.recent-right { text-align: right; }
.recent-status { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.recent-time { font-size: 11px; color: #484f58; }

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

@media (max-width: 640px) {
  .hero-amount { font-size: 28px; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-card { padding: 24px 20px 20px; }
}

/* ===== Order Layout ===== */
.order-layout { display: grid; grid-template-columns: 380px 1fr; gap: 20px; }
@media (max-width: 768px) { .order-layout { grid-template-columns: 1fr; } }

/* ===== Order Panel (Tab UI) ===== */
.order-panel { border-radius: 12px; border: 2px solid #30363d; overflow: hidden; transition: border-color 0.2s; }
.order-panel[data-type="BUY"]  { border-color: #c0392b; }
.order-panel[data-type="SELL"] { border-color: #1565c0; }

.order-tabs { display: grid; grid-template-columns: 1fr 1fr; }
.order-tab { padding: 14px 0; font-size: 16px; font-weight: 700; border: none; cursor: pointer; transition: all 0.2s; letter-spacing: 0.05em; }
.tab-buy  { background: #1a1010; color: #c0392b; }
.tab-sell { background: #10101a; color: #1565c0; }
.tab-buy.active  { background: #c0392b; color: #fff; }
.tab-sell.active { background: #1565c0; color: #fff; }

.order-panel-body { background: #161b22; padding: 20px; }

/* 지정가/시장가 토글 */
.price-type-group { display: flex; gap: 8px; }
.price-type-btn { flex: 1; padding: 8px 0; background: #21262d; border: 1px solid #30363d; border-radius: 6px; color: #8b949e; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.price-type-btn.active { background: #21262d; border-color: #8b949e; color: #e2e8f0; }

/* 제출 버튼 — 탭 색상 연동 */
.btn-submit { background: #c0392b; border-color: #e74c3c; color: #fff; transition: background 0.2s, border-color 0.2s; }
.order-panel[data-type="SELL"] .btn-submit { background: #1565c0; border-color: #1976d2; }
.btn-submit:hover { filter: brightness(1.1); }

/* 구분선 */
.divider-or { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; color: #484f58; font-size: 12px; }
.divider-or::before, .divider-or::after { content: ''; flex: 1; height: 1px; background: #21262d; }

/* input 단위 */
.input-unit { display: flex; align-items: center; padding: 0 10px; background: #21262d; border: 1px solid #30363d; border-radius: 0 6px 6px 0; color: #8b949e; font-size: 13px; white-space: nowrap; margin-left: -1px; }
.input-row .form-control:has(+ .input-unit) { border-radius: 6px 0 0 6px; }

/* ===== Custom Select ===== */
.custom-select { position: relative; }
.custom-select-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; background: #0d1117; border: 1px solid #30363d;
  border-radius: 8px; color: #484f58; font-size: 14px; cursor: pointer;
  transition: border-color 0.15s; text-align: left;
}
.custom-select-trigger:hover { border-color: #58a6ff; }
.custom-select-arrow { font-size: 12px; color: #8b949e; transition: transform 0.2s; flex-shrink: 0; margin-left: 8px; }

.custom-select-list {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #1c2128; border: 1px solid #30363d; border-radius: 10px;
  list-style: none; overflow-y: auto; max-height: 220px;
  z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  padding: 4px 0;
}
.custom-select-list.open { display: block; animation: fadeDown 0.15s ease; }

.custom-select-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; cursor: pointer; transition: background 0.1s;
}
.custom-select-item:hover { background: #21262d; }
.custom-select-item.selected { background: #0d1f36; }
.csi-code { font-family: monospace; font-size: 12px; color: #8b949e; flex-shrink: 0; }
.csi-name { font-size: 14px; color: #c9d1d9; font-weight: 500; }
.custom-select-empty { padding: 16px 14px; color: #484f58; font-size: 13px; }

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

/* ===== Stepper / Quick Buttons ===== */
.stepper-wrap { display: flex; flex-direction: column; gap: 6px; }
.quick-btns { display: flex; gap: 4px; }
.qbtn { flex: 1; padding: 5px 0; background: #21262d; border: 1px solid #30363d; border-radius: 5px; color: #8b949e; font-size: 11px; font-weight: 500; cursor: pointer; transition: all 0.12s; white-space: nowrap; }
.qbtn:hover { background: #30363d; color: #c9d1d9; }
.qbtn-plus { color: #58a6ff; border-color: #1f3a5f; background: #0d1f36; }
.qbtn-plus:hover { background: #1f3a5f; color: #79c0ff; }
.qbtn-reset { color: #484f58; font-size: 10px; }
.qbtn-reset:hover { color: #8b949e; }

/* ghost 버튼 */
.btn-ghost { background: #21262d; border: 1px solid #30363d; color: #c9d1d9; border-radius: 0 6px 6px 0; padding: 9px 14px; cursor: pointer; font-size: 13px; white-space: nowrap; margin-left: -1px; }
.btn-ghost:hover { background: #30363d; }
.input-row #stockCode { border-radius: 6px 0 0 6px; }

/* ===== Stock Info ===== */
.stock-info { background: #0d1117; border: 1px solid #30363d; border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.stock-name { font-size: 15px; font-weight: 600; color: #c9d1d9; margin-bottom: 6px; }
.stock-price-row { display: flex; align-items: baseline; gap: 10px; }
.current-price { font-size: 22px; font-weight: 700; color: #e2e8f0; }
.price-change.up { color: #f85149; }
.price-change.down { color: #58a6ff; }

/* ===== Order Amount ===== */
.order-amount-row { display: flex; justify-content: space-between; padding: 12px; background: #0d1117; border-radius: 6px; margin-bottom: 16px; color: #8b949e; }
.amount { font-weight: 600; color: #e2e8f0; }

/* ===== Table ===== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 12px; text-align: left; color: #8b949e; font-size: 12px; font-weight: 500; border-bottom: 1px solid #21262d; white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid #21262d; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #1c2128; }
.empty { text-align: center; color: #484f58; padding: 32px !important; }

/* ===== Badges & Status ===== */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-buy { background: #2d1c1c; color: #f85149; }
.badge-sell { background: #1c1c2d; color: #79c0ff; }
.stock-code { font-family: monospace; color: #8b949e; font-size: 12px; }
.status-완료 { color: #3fb950; }
.status-접수 { color: #d29922; }
.status-실패 { color: #f85149; }

/* ===== Card Title Row ===== */
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #21262d; }
.card-title-row .card-title { margin: 0; padding: 0; border: none; }
.card-more { font-size: 12px; color: #58a6ff; text-decoration: none; }
.card-more:hover { text-decoration: underline; }

/* ===== Reserved Order Cards ===== */
.rv-section-label { font-size: 11px; font-weight: 600; color: #8b949e; text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 0 6px; border-top: 1px solid #21262d; margin-top: 4px; }
.rv-section-label:first-child { border-top: none; margin-top: 0; }
.rv-section-done { color: #484f58; }
.rv-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.rv-card { border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
.rv-pending { background: #0d1117; border: 1px solid #30363d; }
.rv-done    { background: #0a0c10; border: 1px solid #21262d; opacity: 0.75; }
.rv-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rv-row-top  { font-size: 13px; }
.rv-row-bottom { font-size: 12px; }
.rv-name  { font-weight: 600; color: #e2e8f0; }
.rv-detail { color: #8b949e; flex: 1; }
.rv-time   { font-size: 11px; color: #484f58; margin-left: auto; }
.rv-status { margin-left: auto; font-size: 11px; font-weight: 600; }
.rv-status-완료 { color: #3fb950; }
.rv-status-실패 { color: #f85149; }
.rv-status-취소 { color: #484f58; }
.rv-msg  { font-size: 11px; color: #484f58; padding-left: 4px; }
.rv-empty { padding: 20px; text-align: center; color: #484f58; font-size: 13px; }
.rv-confirm-info { background: #1c2333; border: 1px solid #1f6feb; border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #79c0ff; margin-bottom: 16px; text-align: center; }

/* ===== Order History Cards ===== */
.ho-list { display: flex; flex-direction: column; gap: 8px; }
.ho-card { background: #161b22; border: 1px solid #30363d; border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ho-card:hover { border-color: #484f58; }

.ho-row { display: flex; align-items: center; }
.ho-row-top { justify-content: space-between; gap: 8px; }
.ho-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.ho-name { font-size: 15px; font-weight: 600; color: #c9d1d9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ho-row-bottom { flex-wrap: wrap; gap: 6px 0; border-top: 1px solid #21262d; padding-top: 10px; }
.ho-field { display: flex; align-items: center; gap: 5px; width: 50%; }
.ho-field-full { width: 100%; }
.ho-label { font-size: 11px; color: #484f58; white-space: nowrap; }
.ho-value { font-size: 13px; color: #8b949e; }
.ho-amount { color: #c9d1d9; font-weight: 600; }
.ho-orderno { font-family: monospace; font-size: 11px; color: #484f58; }

/* ===== Order History Page ===== */
.history-total { font-size: 13px; color: #8b949e; }
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-group { display: flex; gap: 4px; }
.filter-btn { padding: 5px 12px; background: #21262d; border: 1px solid #30363d; border-radius: 20px; color: #8b949e; font-size: 12px; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.filter-btn.active { background: #1f3a5f; border-color: #58a6ff; color: #79c0ff; }
.filter-search-wrap { position: relative; flex: 1; min-width: 160px; }
.filter-search { width: 100%; padding: 6px 32px 6px 12px; background: #0d1117; border: 1px solid #30363d; border-radius: 20px; color: #e2e8f0; font-size: 13px; outline: none; }
.filter-search:focus { border-color: #58a6ff; }
.filter-search::placeholder { color: #484f58; }
.filter-search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #484f58; font-size: 12px; cursor: pointer; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all 0.15s; }
.filter-search-clear:hover { background: #21262d; color: #c9d1d9; }
.td-date { color: #8b949e; font-size: 12px; white-space: nowrap; }
.td-time { color: #8b949e; font-size: 12px; }
.td-orderno { font-family: monospace; font-size: 11px; color: #484f58; }
.history-empty-filter { text-align: center; color: #484f58; padding: 32px; font-size: 13px; }

/* ===== Up/Down Colors ===== */
.up { color: #f85149; }
.down { color: #58a6ff; }

/* ===== Toolbar ===== */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.last-update { font-size: 12px; color: #484f58; }

/* ===== Stock Master Status Bar ===== */
.sm-status-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #0d1117; border: 1px solid #30363d; border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; }
.sm-count { font-size: 12px; color: #8b949e; }

/* ===== Stock Search Results ===== */
.search-result-label { font-size: 11px; color: #484f58; margin-bottom: 6px; }
.search-result-list { list-style: none; border: 1px solid #30363d; border-radius: 10px; overflow: hidden; max-height: 280px; overflow-y: auto; }
.search-result-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border-bottom: 1px solid #21262d; transition: background 0.1s; }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #1c2128; }
.sri-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sri-name { font-size: 14px; font-weight: 500; color: #c9d1d9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sri-btn { flex-shrink: 0; }
.search-loading { text-align: center; color: #484f58; font-size: 13px; padding: 16px 0; }
.search-empty { text-align: center; color: #484f58; font-size: 13px; padding: 16px 0; }

/* ===== Watchlist Cards ===== */
.wl-list { display: flex; flex-direction: column; gap: 8px; }
.wl-card { background: #161b22; border: 1px solid #30363d; border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.wl-card:hover { border-color: #484f58; }
.wl-row { display: flex; align-items: center; }
.wl-row-top { justify-content: space-between; gap: 8px; }
.wl-name-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wl-name { font-size: 15px; font-weight: 600; color: #c9d1d9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-price-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.wl-price { font-size: 16px; font-weight: 700; color: #e2e8f0; font-variant-numeric: tabular-nums; }
.wl-rate { font-size: 12px; font-weight: 600; }
.wl-row-bottom { justify-content: space-between; border-top: 1px solid #21262d; padding-top: 10px; gap: 8px; flex-wrap: wrap; }
.wl-stats { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wl-stat-label { font-size: 11px; color: #484f58; }
.wl-stat-val { font-size: 12px; color: #8b949e; }
.wl-stat-divider { color: #30363d; }
.wl-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ===== Auto Order ===== */
.auto-info-banner { background: #0d1f36; border: 1px solid #1f3a5f; border-radius: 8px; padding: 12px 16px; color: #79c0ff; font-size: 13px; margin-bottom: 20px; }
.auto-list { display: flex; flex-direction: column; gap: 12px; }
.auto-card { display: flex; align-items: center; gap: 16px; background: #161b22; border: 1px solid #30363d; border-radius: 12px; padding: 16px 20px; transition: opacity 0.2s; }
.auto-card-inactive { opacity: 0.45; }
.auto-card-left { text-align: center; min-width: 60px; }
.auto-time { font-size: 22px; font-weight: 700; color: #e2e8f0; font-variant-numeric: tabular-nums; }
.auto-label { font-size: 11px; color: #484f58; margin-top: 2px; }
.auto-card-center { flex: 1; }
.auto-stock-name { font-size: 16px; font-weight: 600; color: #c9d1d9; margin-bottom: 4px; }
.auto-stock-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.auto-qty { color: #e2e8f0; font-weight: 600; }
.auto-ptype { font-size: 12px; color: #8b949e; }
.auto-last-run { font-size: 11px; color: #484f58; margin-top: 4px; }
.auto-card-right { display: flex; align-items: center; gap: 10px; }

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #21262d; border-radius: 24px; border: 1px solid #30363d; transition: 0.2s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #484f58; border-radius: 50%; transition: 0.2s; }
.toggle-switch input:checked + .toggle-slider { background: #238636; border-color: #2ea043; }
.toggle-switch input:checked + .toggle-slider::before { background: #fff; transform: translateX(20px); }

/* Date range on card */
.auto-date-range { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 12px; color: #8b949e; flex-wrap: wrap; }
.date-range-icon { font-size: 11px; }
.date-sep { color: #484f58; }
.date-badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-running { background: #1c2d1c; color: #3fb950; }
.badge-pending { background: #2d2515; color: #d29922; }
.badge-expired { background: #2d1c1c; color: #6e4040; }
.auto-card-expired { opacity: 0.35; }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Preview */
.auto-preview { background: #0d1117; border: 1px solid #238636; border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; }
.auto-preview #previewMain { color: #3fb950; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.preview-sub { color: #484f58; font-size: 12px; }

/* ===== Balance Summary ===== */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
@media (max-width: 768px) { .summary-grid { grid-template-columns: repeat(2, 1fr); } }
.summary-card { background: #161b22; border: 1px solid #30363d; border-radius: 10px; padding: 16px 20px; }
.summary-label { font-size: 12px; color: #8b949e; margin-bottom: 8px; }
.summary-value { font-size: 20px; font-weight: 700; color: #e2e8f0; }

/* ===== Balance Stock Cards ===== */
.bl-list  { display: flex; flex-direction: column; gap: 8px; }
.bl-card  { background: #0d1117; border: 1px solid #30363d; border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.bl-row   { display: flex; align-items: center; }
.bl-row-top    { justify-content: space-between; gap: 8px; }
.bl-row-bottom { flex-wrap: wrap; }
.bl-name-wrap  { display: flex; align-items: center; gap: 8px; }
.bl-name  { font-size: 15px; font-weight: 600; color: #e2e8f0; }
.bl-profit-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.bl-profit { font-size: 14px; font-weight: 600; }
.bl-rate   { font-size: 12px; font-weight: 600; }
.bl-stats  { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bl-stat   { display: flex; align-items: center; gap: 4px; }
.bl-stat-label { font-size: 11px; color: #8b949e; }
.bl-stat-val   { font-size: 12px; color: #c9d1d9; }
.bl-divider    { color: #30363d; font-size: 11px; }
.bl-empty { padding: 24px; text-align: center; color: #484f58; font-size: 13px; }

/* ===== Modal ===== */
.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 {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 28px;
  width: 100%; max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-wide { max-width: 520px; }
.modal h3 { font-size: 17px; font-weight: 600; margin-bottom: 20px; }
.confirm-modal { max-width: 320px; padding: 28px 24px 22px; }
.confirm-msg { font-size: 15px; color: #e2e8f0; text-align: center; margin: 0 0 24px; line-height: 1.5; }
.modal-body { margin-bottom: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* 모바일: 바텀시트 */
@media (max-width: 640px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal, .modal-wide {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
    max-height: 92vh;
    animation: slideUp 0.25s ease;
  }
  .modal h3 {
    font-size: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #21262d;
    margin-bottom: 16px;
    /* 손잡이 바 */
    text-align: left;
  }
  .modal h3::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: #30363d;
    border-radius: 2px;
    margin: 0 auto 14px;
  }
  .modal-actions {
    flex-direction: column-reverse;
    gap: 8px;
    margin-top: 8px;
  }
  .modal-actions .btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    justify-content: center;
  }
  /* 폼 요소 모바일 터치 최적화 */
  .modal .form-control {
    padding: 12px 14px;
    font-size: 16px; /* iOS 줌 방지 */
  }
  .modal select.form-control { font-size: 16px; }
  .modal .price-type-btn {
    padding: 11px 0;
    font-size: 14px;
  }
  .modal .qbtn {
    padding: 9px 0;
    font-size: 13px;
  }
  .modal .input-unit {
    padding: 0 12px;
    font-size: 14px;
  }
  .form-row-2 { grid-template-columns: 1fr; gap: 0; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.confirm-table { width: 100%; }
.confirm-table td { padding: 8px 4px; }
.confirm-table td:first-child { color: #8b949e; width: 90px; }
.confirm-table td:last-child { font-weight: 600; }

/* ===== Loading ===== */
.loading-msg { text-align: center; color: #8b949e; padding: 40px; }
