/* ======================================
   AlphaTrade Pro - Admin Dashboard Styles
   ====================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2962ff;
  --primary-dark: #0039cb;
  --primary-light: #768fff;
  --accent: #00c853;
  --accent-dark: #009624;
  --danger: #ff1744;
  --warning: #ff9100;
  --bg: #0a0e17;
  --bg-card: #111827;
  --bg-dark: #060a12;
  --bg-highlight: #1a2332;
  --text: #e8eaed;
  --text-muted: #9aa0a6;
  --text-dim: #5f6368;
  --border: #1e2a3a;
  --border-light: #2a3a4a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --transition: 0.3s ease;
  --sidebar-w: 220px;
  --topbar-h: 56px;
}

html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  overflow-x: hidden;
}
a { color: var(--primary-light); text-decoration: none; }
a:hover { color: var(--primary); }

/* --- Login Page --- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.login-card .logo { width: 48px; height: 48px; border-radius: 12px; margin-bottom: 16px; }
.login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-card .subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }
.login-card .error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
}

/* --- Topbar --- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--topbar-h);
  background: rgba(10,14,23,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-logo { font-size: 20px; color: var(--primary-light); }
.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.btn-logout {
  background: none; border: 1px solid var(--border-light); color: var(--text-muted);
  padding: 6px 14px; border-radius: 6px; font-size: 12px; cursor: pointer;
  transition: all var(--transition);
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

/* --- Hamburger Menu Button --- */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px; height: 36px;
  padding: 6px;
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}
.hamburger span {
  display: block;
  width: 100%; height: 2px;
  background: var(--text-muted);
  border-radius: 1px;
  transition: all 0.3s ease;
}
.hamburger:hover { border-color: var(--primary); }
.hamburger:hover span { background: var(--primary-light); }
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --- Sidebar Backdrop (모바일) --- */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 89;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.sidebar-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

/* --- Sidebar --- */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* iOS 모바일 스크롤 활성화 */
  z-index: 90;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: var(--text-muted);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg-highlight); color: var(--text); }
.nav-item.active {
  border-left-color: var(--primary);
  background: var(--bg-highlight);
  color: #fff;
  font-weight: 600;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px; text-align: center;
}

/* --- Layout --- */
.layout { display: flex; }

/* --- Main Content --- */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 24px;
  min-height: calc(100vh - var(--topbar-h));
  flex: 1;
}
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-title { font-size: 20px; font-weight: 700; margin-bottom: 20px; }

/* --- Stat Cards --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.stat-card .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.stat-card .value.green { color: var(--accent); }
.stat-card .value.blue { color: var(--primary-light); }
.stat-card .value.yellow { color: var(--warning); }
.stat-card .value.orange { color: #ff6d00; }
.stat-card .value.red { color: var(--danger); }
.stat-desc { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
td.green { color: var(--accent); }
td.yellow { color: var(--warning); }
td.orange { color: #ff6d00; }
td.red { color: var(--danger); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-grid .stat-card {
  padding: 16px;
}
.stat-grid .stat-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -1px;
}
.stat-grid .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Tables --- */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--bg-dark);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.data-table .mono { font-family: 'Consolas', monospace; font-size: 12px; }
.data-table .truncate { max-width: 140px; }

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-pending { background: rgba(255,145,0,0.15); color: var(--warning); }
.badge-completed { background: rgba(0,200,83,0.15); color: var(--accent); }
.badge-license_ready { background: rgba(41,98,255,0.15); color: var(--primary-light); }
.badge-rejected { background: rgba(255,23,68,0.15); color: var(--danger); }
/* ★ v6.11.3 Self-Learning Phase 2: 알림창/추천 상태 배지 (statusBadge 호환) */
.badge-unread { background: rgba(255,145,0,0.2); color: var(--warning); }
.badge-read { background: rgba(41,98,255,0.15); color: var(--primary-light); }
.badge-done { background: rgba(0,200,83,0.15); color: var(--accent); }
.badge-evaluating { background: rgba(94,102,115,0.15); color: var(--text-dim); }
.badge-proposed { background: rgba(41,98,255,0.15); color: var(--primary-light); }
.badge-approved { background: rgba(0,200,83,0.15); color: var(--accent); }
.badge-applied { background: rgba(0,200,83,0.25); color: var(--accent); }
.badge-rolled_back { background: rgba(255,145,0,0.15); color: var(--warning); }
.badge-revoked { background: rgba(94,102,115,0.15); color: var(--text-dim); }
.badge-blocked { background: rgba(255,23,68,0.25); color: #ff6b7a; }
.badge-long { background: rgba(0,200,83,0.2); color: #2ee97a; }
.badge-short { background: rgba(255,40,60,0.2); color: #ff5c6c; }
.clients-table td { max-width: none; overflow: visible; text-overflow: unset; white-space: normal; }
.badge-active { background: rgba(0,200,83,0.15); color: var(--accent); }
.badge-inactive { background: rgba(94,102,115,0.15); color: var(--text-dim); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  border: none; border-radius: 6px;
  font-size: 12px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--accent); color: #000; }
.btn-success:hover { background: var(--accent-dark); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d50000; }
.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { background: #e68200; }
.btn-outline {
  background: none; border: 1px solid var(--border-light);
  color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary-light); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239aa0a6' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.form-select option { background: var(--bg-card); color: var(--text); }
.form-textarea { resize: vertical; min-height: 80px; }

/* --- Filter Bar --- */
.filter-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-bar .form-select, .filter-bar .form-input {
  width: auto; min-width: 140px;
  padding: 7px 32px 7px 10px;
  font-size: 12px;
}
.filter-bar .auto-refresh {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-dim);
}
.filter-bar .auto-refresh .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* --- Modal --- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: opacity 0.2s ease, backdrop-filter 0.2s ease, -webkit-backdrop-filter 0.2s ease;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%; max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}
.modal-overlay.show .modal { transform: scale(1); }
.modal h2 { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* --- Toast --- */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 300;
  display: flex; flex-direction: column-reverse; gap: 8px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  display: flex; align-items: center; gap: 8px;
  min-width: 280px;
}
.toast.success { border-left: 3px solid var(--accent); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* --- Config Cards --- */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.config-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.config-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.config-name { font-size: 16px; font-weight: 700; text-transform: capitalize; }
.config-body { margin-bottom: 16px; }
.config-body > div { margin-bottom: 4px; }
.config-actions { display: flex; gap: 8px; }

/* --- Log Tree --- */
.log-tree {}
.log-client {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.log-client-header {
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
  transition: background var(--transition);
}
.log-client-header:hover { background: var(--bg-highlight); }
.log-client-header .hash { font-family: 'Consolas', monospace; font-size: 13px; }
.log-client-header .info { font-size: 12px; color: var(--text-dim); }
.log-files {
  display: none;
  padding: 0 16px 12px;
}
.log-files.show { display: block; }
.log-file {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.log-file:last-child { border-bottom: none; }
.log-file a { font-family: 'Consolas', monospace; }

/* --- Pagination --- */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 16px;
}
.pagination .page-btn {
  background: var(--bg-highlight);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.pagination .page-btn:hover { border-color: var(--primary); color: var(--text); }
.pagination .page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .page-info { font-size: 12px; color: var(--text-dim); margin: 0 8px; }

/* --- Empty state --- */
.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--text-dim); font-size: 14px;
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }

/* --- Card --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

/* --- Log Toggle --- */
.log-toggle {
  font-size: 10px; color: var(--text-dim);
  margin-right: 10px; transition: transform 0.2s ease;
  display: inline-block;
}
.log-client-header { gap: 10px; }

/* --- Overview Grid --- */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}
.overview-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.section-title {
  font-size: 14px; font-weight: 600; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}

/* --- Stat Card clickable --- */
.stat-card.clickable { cursor: pointer; transition: all 0.3s ease; }
.stat-card.clickable:hover { border-color: var(--primary); transform: translateY(-2px); }
.stat-desc { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* --- Info Grid --- */
.info-grid { display: flex; flex-direction: column; gap: 10px; }
.info-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.info-item:last-child { border-bottom: none; }
.info-label { font-size: 12px; color: var(--text-muted); }
.info-value { font-size: 13px; color: var(--text); }

/* --- Quick Actions --- */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: var(--bg-highlight);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
}
.quick-btn:hover { border-color: var(--primary); color: var(--text); background: rgba(41,98,255,0.08); }
.quick-icon { font-size: 18px; }

/* --- Detail Grid (모달) --- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.detail-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.detail-item.full { grid-column: 1 / -1; }
.detail-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.3px; }
.detail-value { font-size: 13px; color: var(--text); word-break: break-all; }

/* --- Clickable Row --- */
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: rgba(41,98,255,0.06) !important; }

/* --- Revenue Summary Cards --- */
.revenue-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.revenue-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.revenue-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
}
.revenue-card.total::before { background: linear-gradient(90deg, var(--accent), #4caf50); }
.revenue-card.monthly::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.revenue-card.count::before { background: linear-gradient(90deg, var(--warning), #ffca28); }
.revenue-card .rev-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.revenue-card .rev-value { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.revenue-card .rev-sub { font-size: 11px; color: var(--text-dim); margin-top: 6px; }

/* --- Exchange Revenue Breakdown --- */
.exchange-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.exch-rev-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.exch-rev-card .exch-name { font-size: 13px; font-weight: 600; text-transform: uppercase; margin-bottom: 6px; }
.exch-rev-card .exch-amount { font-size: 18px; font-weight: 800; color: var(--accent); }
.exch-rev-card .exch-vol { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* --- Utility --- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mono { font-family: 'Consolas', 'Courier New', monospace; }
.text-success { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .hamburger { display: flex; }
  .sidebar-backdrop { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .revenue-summary { grid-template-columns: 1fr; }
  .modal { margin: 16px; max-width: calc(100vw - 32px); }
}
@media (max-width: 600px) {
  .topbar { padding: 0 12px; }
  .topbar-title { font-size: 14px; }
  .main-content { padding: 16px; }
  .stats-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-select, .filter-bar .form-input { width: 100%; min-width: unset; }
  .quick-actions { grid-template-columns: 1fr; }
  .exchange-breakdown { grid-template-columns: repeat(2, 1fr); }
  .data-table td, .data-table th { padding: 8px 8px; font-size: 11px; }
  .comm-exchange-cards { grid-template-columns: 1fr; }
  .comm-daily-summary-cards { grid-template-columns: 1fr; }
}

/* ======================================
   커미션 수집 탭 스타일
   ====================================== */

.comm-section { }

.comm-total-card {
  background: linear-gradient(135deg, rgba(41,98,255,0.15), rgba(0,200,83,0.1));
  border: 1px solid rgba(41,98,255,0.3);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.comm-total-label { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.comm-total-value { font-size: 28px; font-weight: 700; color: var(--accent); font-family: monospace; }

.comm-exchange-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.comm-exch-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: var(--transition);
}
.comm-exch-card:hover { border-color: var(--primary); }
.comm-exch-card.comm-error { border-color: rgba(231,76,60,0.3); }
.comm-exch-name { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.comm-exch-balance { font-size: 16px; font-weight: 600; font-family: monospace; }
.comm-exch-detail { margin-top: 4px; }

.comm-daily-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.comm-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.comm-summary-card.total {
  background: linear-gradient(135deg, rgba(46,204,113,0.08), rgba(41,98,255,0.05));
  border-color: rgba(46,204,113,0.3);
}
.comm-summary-card .label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.comm-summary-card .value { font-size: 18px; font-weight: 600; font-family: monospace; }
.comm-summary-card .sub { font-size: 11px; margin-top: 2px; }

/* 바 차트 */
.comm-chart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.comm-chart-title { margin-bottom: 12px; }
.comm-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 120px;
}
.comm-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  cursor: pointer;
}
.comm-bar {
  width: 100%;
  border-radius: 2px 2px 0 0;
  min-height: 3px;
  transition: all 0.2s;
}
.comm-bar-pos { background: var(--accent); }
.comm-bar-neg { background: var(--danger); }
.comm-bar-wrap:hover .comm-bar { opacity: 0.7; }
.comm-bar-label {
  font-size: 8px;
  color: var(--text-dim);
  margin-top: 4px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  max-height: 28px;
  overflow: hidden;
}

.comm-sub-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }

/* ======================================
   Backtest Tab
   ====================================== */
.bt-section { margin-top: 16px; }
.bt-section .card-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.bt-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.bt-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bt-method-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.bt-method-card {
  background: var(--bg-highlight);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition);
}
.bt-method-card.active { border-color: var(--primary); }
.bt-method-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bt-method-label { font-weight: 600; font-size: 13px; }

/* Toggle switch */
.bt-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.bt-toggle input { opacity: 0; width: 0; height: 0; }
.bt-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-light);
  border-radius: 22px;
  cursor: pointer;
  transition: background var(--transition);
}
.bt-toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}
.bt-toggle input:checked + .bt-toggle-slider { background: var(--primary); }
.bt-toggle input:checked + .bt-toggle-slider::before { transform: translateX(18px); }

/* Filter checkboxes */
.bt-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.bt-filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.bt-filter-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

/* Settings row in modal */
.bt-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.bt-setting-row:last-child { border-bottom: none; }
.bt-setting-row label { font-size: 13px; color: var(--text-muted); }
.bt-setting-row input,
.bt-setting-row select {
  width: 120px;
  text-align: right;
}

/* Run bar */
.bt-run-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-highlight);
  border-radius: var(--radius-sm);
}
.bt-progress-text { color: var(--text-muted); font-size: 13px; }

/* Method summary in results */
.bt-method-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.bt-method-stat {
  background: var(--bg-highlight);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
}
.bt-method-stat .name { color: var(--text-muted); }
.bt-method-stat .val { font-weight: 600; margin-top: 2px; }

/* Import/export */
.bt-import-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.bt-method-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

/* Sweep 결과 테이블 */
.bt-sweep-table th,
.bt-sweep-table td {
  white-space: nowrap;
  text-align: center;
  padding: 6px 10px;
}
.bt-sweep-best td {
  background: rgba(74, 222, 128, 0.08);
  font-weight: 600;
}

/* ── 백테스트 6탭 구조 (v6.4.2) ── */
.bt-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.bt-tab {
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.bt-tab:hover { color: var(--text); background: var(--bg-highlight); }
.bt-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.bt-tab-content { display: none; }
.bt-tab-content.active { display: block; }

/* ── 아코디언 ── */
.bt-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 8px 0;
  overflow: hidden;
}
.bt-accordion-header {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-highlight);
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  transition: background var(--transition);
}
.bt-accordion-header:hover { background: var(--bg-card); }
.bt-accordion-header::after {
  content: '\25B6';
  font-size: 10px;
  transition: transform 0.2s;
}
.bt-accordion.open .bt-accordion-header::after { transform: rotate(90deg); }
.bt-accordion-body {
  padding: 0 16px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}
.bt-accordion.open .bt-accordion-body {
  max-height: 2000px;
  padding: 12px 16px;
}

/* ── 진단 패널 ── */
.bt-diagnostic {
  background: rgba(255, 193, 7, 0.08);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 12px;
}
.bt-diagnostic h4 {
  color: #fbbf24;
  margin: 0 0 8px 0;
  font-size: 14px;
}
.bt-diagnostic p { margin: 4px 0; font-size: 13px; color: var(--text-muted); }
.bt-diagnostic .bt-diag-tip {
  background: rgba(74, 222, 128, 0.08);
  border-left: 3px solid #4ade80;
  padding: 8px 12px;
  margin-top: 8px;
  font-size: 12px;
  color: #4ade80;
}

/* ── 매매법별 패턴 테이블 ── */
.bt-pattern-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.bt-pattern-table th {
  padding: 6px 8px;
  text-align: center;
  background: var(--bg-highlight);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
}
.bt-pattern-table td {
  padding: 4px 6px;
  border: 1px solid var(--border);
  text-align: center;
}
.bt-pattern-table input {
  width: 60px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 2px 4px;
}

/* ── 토글 인라인 행 ── */
.bt-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.bt-toggle-row:last-child { border-bottom: none; }
.bt-toggle-row label { font-size: 13px; }

/* ── 그리드 확장 ── */
.bt-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }

@media (max-width: 900px) {
  .bt-method-grid { grid-template-columns: repeat(2, 1fr); }
  .bt-filter-grid { grid-template-columns: repeat(2, 1fr); }
  .bt-grid-3 { grid-template-columns: 1fr 1fr; }
  .bt-grid-4 { grid-template-columns: 1fr 1fr; }
  .bt-tabs { gap: 2px; }
  .bt-tab { padding: 6px 10px; font-size: 12px; }
}

/* ===== 서버 로그 탭 (v6.4.0) ===== */
.sl-log-area {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
  max-height: 70vh;
  overflow-y: auto;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  line-height: 1.5;
}
.sl-line { padding: 1px 4px; white-space: pre-wrap; word-break: break-all; color: #c9d1d9; }
.sl-line.sl-error { color: #f85149; background: rgba(248,81,73,0.1); }
.sl-line.sl-warn { color: #d29922; background: rgba(210,153,34,0.08); }
.sl-line.sl-debug { color: #8b949e; }

/* ═══════════════════════════════════════
   스냅샷 상세 모달
   ═══════════════════════════════════════ */

.snap-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 700px) {
  .snap-detail-grid { grid-template-columns: 1fr; }
}

.snap-section {
  background: var(--bg-highlight, #1a2332);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}
.snap-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #9aa0a6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* info 그리드 (라벨-값 쌍) */
.snap-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}
.snap-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}
.snap-label {
  font-size: 12px;
  color: var(--text-muted, #9aa0a6);
}
.snap-value {
  font-size: 13px;
  font-weight: 500;
  text-align: right;
}

/* 메트릭 가로 행 */
.snap-metrics-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.snap-metric {
  flex: 1;
  min-width: 80px;
  text-align: center;
  background: var(--bg-card, #111827);
  border-radius: 6px;
  padding: 8px 4px;
}
.snap-metric-val {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text, #e8eaed);
}
.snap-metric-lbl {
  display: block;
  font-size: 11px;
  color: var(--text-muted, #9aa0a6);
  margin-top: 2px;
}

/* 접기/펼치기 섹션 */
.snap-collapsible .snap-section-body { display: none; }
.snap-collapsible.open .snap-section-body { display: block; }
.snap-collapsible .snap-section-title { cursor: pointer; user-select: none; }
.snap-toggle {
  float: right;
  font-weight: bold;
  font-size: 14px;
  color: var(--primary-light, #768fff);
}
.snap-collapsible.open .snap-toggle::after { content: ''; }

/* ═══════════════════════════════════════
   누락 유틸 클래스 패치 (v6.6.21)
   ═══════════════════════════════════════ */

/* .input — backtest/migrations 폼 요소 공통 클래스 */
.input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
.input:focus { border-color: var(--primary); }
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239aa0a6' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}
select.input option { background: var(--bg-card); color: var(--text); }

/* .label — btField() 라벨 */
.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* .stats-grid — migrations 통계 그리드 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stats-grid .stat-card { padding: 16px; }
.stats-grid .stat-value { font-size: 24px; font-weight: 800; letter-spacing: -1px; }
.stats-grid .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* .card-header / .card-body — 백테스트 결과 패널 */
.card-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-dark);
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-body { padding: 16px 20px; }

/* 배지 색상 보완 */
.badge-green { background: rgba(0,200,83,0.15); color: var(--accent); }
.badge-yellow { background: rgba(255,145,0,0.15); color: var(--warning); }
.badge-red { background: rgba(255,23,68,0.15); color: var(--danger); }
.badge-dim { background: rgba(94,102,115,0.15); color: var(--text-dim); }
.snap-collapsible:not(.open) .snap-toggle::after { content: ''; }

/* 이벤트 타임라인 */
.snap-timeline {
  position: relative;
  padding-left: 24px;
}
.snap-timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255,255,255,0.1);
}
.snap-ev {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  position: relative;
}
.snap-ev + .snap-ev {
  border-top: 1px solid rgba(255,255,255,0.04);
}
.snap-ev-marker {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  z-index: 1;
  margin-left: -12px;
}
.snap-ev-content {
  flex: 1;
  min-width: 0;
}
.snap-ev-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.snap-ev-type {
  font-weight: 600;
  font-size: 13px;
}
.snap-ev-time {
  color: var(--text-muted, #9aa0a6);
  font-size: 12px;
}
.snap-ev-price {
  font-size: 12px;
  color: var(--text, #e8eaed);
}
.snap-ev-pnl {
  font-size: 12px;
  font-weight: 600;
}
.snap-ev-desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted, #9aa0a6);
  line-height: 1.5;
  word-break: break-word;
}
