:root { --bg-primary: #0a0d14; --bg-card: rgba(20,24,38,0.85); --bg-hover: rgba(59,130,246,0.08); --border: rgba(255,255,255,0.07); --text-primary: #e2e8f0; --text-muted: #7d90a4; --accent: #3b82f6; --accent-glow: rgba(59,130,246,0.3); }
* { box-sizing: border-box; }
body { background-color: var(--bg-primary); color: var(--text-primary); font-family: 'Inter', -apple-system, sans-serif; margin: 0; padding: 16px; }
.glass { background: var(--bg-card); backdrop-filter: blur(16px); border: 1px solid var(--border); border-radius: 14px; }
.text-gradient { background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 800; }

/* Asset Class Tabs */
.ac-tab { padding: 8px 18px; border-radius: 10px; background: transparent; color: var(--text-muted); border: 1px solid transparent; font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.ac-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.ac-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 0 20px var(--accent-glow); }

/* Sector Tabs */
.sec-tab { padding: 6px 14px; border-radius: 8px; background: rgba(255,255,255,0.03); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.06); font-weight: 500; font-size: 0.82rem; cursor: pointer; transition: all 0.15s; white-space: nowrap; margin: 3px; }
.sec-tab:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.15); }
.sec-tab.active { background: rgba(59,130,246,0.15); color: #93c5fd; border-color: rgba(59,130,246,0.4); }
.sec-tab .sec-count { font-size: 0.7rem; opacity: 0.6; margin-left: 4px; }
/* Super-sector tab */
.super-sec-tab { background: rgba(59,130,246,0.07); border-color: rgba(59,130,246,0.2); color: #93c5fd; }
.super-sec-tab:hover { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.4); }
.super-sec-tab.active { background: rgba(59,130,246,0.22); color: #fff; border-color: rgba(59,130,246,0.6); box-shadow: 0 0 12px rgba(59,130,246,0.2); }
/* Sub-sector tabs row */
#subSecTabs { display:none; padding: 6px 0 2px 0; border-top: 1px solid rgba(59,130,246,0.15); margin-top: 4px; }
.sub-sec-tab { font-size: 0.77rem; padding: 4px 11px; }
.expand-arrow { font-size: 0.65rem; margin-left: 4px; opacity: 0.7; }

/* Summary Cards */
.stat-card { display: flex; flex-direction: column; align-items: center; padding: 12px 8px; background: rgba(10,13,20,0.5); border-radius: 10px; border: 1px solid var(--border); min-width: 90px; }
.stat-card .stat-value { font-size: 1.3rem; font-weight: 700; }
.stat-card .stat-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

/* DataTables Override */
table.dataTable { border-collapse: collapse; width: 100%; color: #cbd5e1; font-size: 0.88rem; }
table.dataTable thead th { background: rgba(20,24,38,0.95); color: #64748b; border-bottom: 2px solid rgba(255,255,255,0.08); padding: 10px 8px; font-weight: 600; font-size: 0.78rem; text-align: right; text-transform: uppercase; letter-spacing: 0.3px; }
table.dataTable tbody td { border-bottom: 1px solid rgba(255,255,255,0.04); padding: 10px 8px; text-align: right; }
table.dataTable tbody tr:hover { background-color: var(--bg-hover) !important; }
table.dataTable thead th.text-left, table.dataTable tbody td.text-left { text-align: left !important; }
.dataTables_wrapper .dataTables_filter input { color: white; background: rgba(20,24,38,0.95); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; padding: 6px 14px; font-size: 0.85rem; }
.dataTables_wrapper .dataTables_filter input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.dataTables_wrapper .dataTables_length select { color: white; background: rgba(20,24,38,0.95); border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; padding: 4px; }
.dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_paginate { color: var(--text-muted); font-size: 0.8rem; padding-top: 12px; }
.dataTables_wrapper .dataTables_paginate .paginate_button { color: var(--text-muted) !important; border: 1px solid rgba(255,255,255,0.06) !important; border-radius: 6px !important; background: transparent !important; margin: 0 2px; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }

/* Legacy badge */
.badge-legacy { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 6px; font-size: 0.72rem; font-weight: 600; background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.badge-active { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 0.72rem; font-weight: 600; background: rgba(34,197,94,0.1); color: #4ade80; border: 1px solid rgba(34,197,94,0.15); }
.badge-short { display: inline-flex; align-items: center; padding: 2px 6px; border-radius: 4px; font-size: 0.65rem; font-weight: 600; background: rgba(234,179,8,0.12); color: #facc15; border: 1px solid rgba(234,179,8,0.2); margin-left: 4px; }
.tag { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 0.65rem; font-weight: 600; margin: 1px; }
.value-up { color: #f87171; } .value-down { color: #60a5fa; }
.row-legacy td { opacity: 0.45; text-decoration: line-through; }
.mine-badge { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #000; padding: 2px 8px; border-radius: 4px; font-size: 0.68rem; font-weight: 800; box-shadow: 0 0 10px rgba(251,191,36,0.4); }
.badge-user-legacy { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 6px; font-size: 0.72rem; font-weight: 600; background: rgba(249,115,22,0.12); color: #fb923c; border: 1px solid rgba(249,115,22,0.3); }
.badge-user-sector { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 5px; font-size: 0.68rem; font-weight: 600; background: rgba(139,92,246,0.12); color: #a78bfa; border: 1px solid rgba(139,92,246,0.25); }

/* Checkbox column */
input.row-cb { width: 15px; height: 15px; cursor: pointer; accent-color: #3b82f6; vertical-align: middle; }
input#select-all-cb { width: 15px; height: 15px; cursor: pointer; accent-color: #3b82f6; }
table.dataTable tbody tr.row-selected { background: rgba(59,130,246,0.08) !important; outline: 1px solid rgba(59,130,246,0.2); }

/* FAB */
#fab { position: fixed; bottom: 28px; right: 28px; z-index: 9999; display: none; animation: fabIn 0.18s ease; }
@keyframes fabIn { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }
#fab-card { background: rgba(20,24,38,0.97); border: 1px solid rgba(59,130,246,0.4); border-radius: 14px; padding: 12px 16px; box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(59,130,246,0.1); backdrop-filter: blur(16px); min-width: 260px; }
#fab-label { font-size: 0.78rem; color: #64748b; margin-bottom: 10px; }
#fab-count { color: #93c5fd; font-weight: 700; }
.fab-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border-radius: 8px; font-size: 0.82rem; font-weight: 600; border: none; cursor: pointer; transition: all 0.15s; }
#fab-btn-legacy { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
#fab-btn-legacy:hover { background: rgba(239,68,68,0.28); }
#fab-btn-unlegacy { background: rgba(34,197,94,0.12); color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
#fab-btn-unlegacy:hover { background: rgba(34,197,94,0.22); }
#fab-btn-move { background: rgba(139,92,246,0.15); color: #a78bfa; border: 1px solid rgba(139,92,246,0.3); }
#fab-btn-move:hover { background: rgba(139,92,246,0.28); }
#fab-btn-clear { background: rgba(255,255,255,0.05); color: #64748b; border: 1px solid rgba(255,255,255,0.08); padding: 7px 10px; }
#fab-btn-clear:hover { background: rgba(255,255,255,0.1); color: #94a3b8; }

/* Watchlist FAB */
#fab-btn-watch   { background: rgba(244,63,94,0.12); color: #fb7185; border: 1px solid rgba(244,63,94,0.3); }
#fab-btn-watch:hover   { background: rgba(244,63,94,0.24); }
#fab-btn-unwatch { background: rgba(100,116,139,0.1);  color: #94a3b8; border: 1px solid rgba(100,116,139,0.2); }
#fab-btn-unwatch:hover { background: rgba(100,116,139,0.2); }
/* 관심종목 탭 */
.watchlist-tab { color: #fb7185 !important; }
.watchlist-tab.active { background: rgba(244,63,94,0.15) !important; color: #fb7185 !important; border-color: rgba(244,63,94,0.45) !important; box-shadow: 0 0 20px rgba(244,63,94,0.2) !important; }
.watchlist-tab:hover:not(.active) { background: rgba(244,63,94,0.08) !important; }
.wl-count { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; border-radius: 9px; background: rgba(251,191,36,0.2); font-size: 0.68rem; font-weight: 800; padding: 0 4px; margin-left: 3px; vertical-align: middle; }
/* Star 버튼 */
.star-btn { background: none; border: none; cursor: pointer; color: #374151; font-size: 0.95rem; line-height: 1; transition: color 0.12s, transform 0.12s; padding: 1px 3px; border-radius: 3px; vertical-align: middle; }
.star-btn:hover   { color: #fb7185; transform: scale(1.25); }
.star-btn.starred { color: #f43f5e; }
/* 관심종목 행 강조 */
table.dataTable tbody tr.row-watchlist { background: rgba(244,63,94,0.04) !important; }
table.dataTable tbody tr.row-watchlist.row-selected { background: rgba(59,130,246,0.1) !important; }

/* 플로팅 저장 버튼 */
#save-float { position: fixed; bottom: 28px; left: 28px; z-index: 9998; display: none; animation: fabIn 0.18s ease; }
#save-float.visible { display: block; }
#save-float-btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 12px; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: background 0.2s, color 0.2s, border-color 0.2s; backdrop-filter: blur(14px); box-shadow: 0 4px 24px rgba(0,0,0,0.45); border: 1px solid rgba(59,130,246,0.45); background: rgba(59,130,246,0.18); color: #93c5fd; }
#save-float-btn:hover:not(:disabled) { background: rgba(59,130,246,0.32); }
#save-float-btn:disabled { cursor: not-allowed; }
#save-float-btn.state-saving { color: #fbbf24; border-color: rgba(251,191,36,0.4); background: rgba(251,191,36,0.1); }
#save-float-btn.state-saved  { color: #4ade80; border-color: rgba(74,222,128,0.4);  background: rgba(74,222,128,0.1); }
#save-float-btn.state-error  { color: #f87171; border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.1); }

/* 카테고리 이동 모달 */
#sector-modal { display:none; position:fixed; inset:0; z-index:10000; background:rgba(0,0,0,0.72); backdrop-filter:blur(4px); align-items:center; justify-content:center; }
#sector-modal.show { display:flex; }
#sector-modal-card { background:#0f1623; border:1px solid rgba(139,92,246,0.4); border-radius:16px; padding:24px; width:min(580px,95vw); max-height:82vh; overflow-y:auto; box-shadow:0 24px 64px rgba(0,0,0,0.7); }
.smb { display:flex; align-items:center; gap:8px; padding:9px 12px; border-radius:8px; border:1px solid rgba(255,255,255,0.07); background:rgba(255,255,255,0.03); color:#cbd5e1; font-size:0.82rem; cursor:pointer; transition:all 0.15s; width:100%; text-align:left; }
.smb:hover { background:rgba(139,92,246,0.15); border-color:rgba(139,92,246,0.4); color:#e2e8f0; }
.smb.cur { border-color:rgba(59,130,246,0.5); background:rgba(59,130,246,0.1); color:#93c5fd; }
.smg { font-size:0.7rem; font-weight:700; text-transform:uppercase; letter-spacing:0.8px; color:#334155; padding:14px 0 5px 2px; }

/* Filter controls */
.filter-input { background: rgba(20,24,38,0.95); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; color: #e2e8f0; padding: 6px 10px; font-size: 0.82rem; width: 90px; }
.filter-input:focus { outline: none; border-color: var(--accent); }
.filter-check { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

/* Tooltip */
.tooltip-container { position: relative; cursor: help; }
.tooltip-content { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #1e293b; color: #e2e8f0; padding: 8px 12px; border-radius: 8px; font-size: 0.75rem; white-space: nowrap; z-index: 999; border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 4px 12px rgba(0,0,0,0.5); max-width: 350px; white-space: normal; }
.tooltip-container:hover .tooltip-content { display: block; }

/* ── Fixed Navbar ── */
.gradient-line { position:fixed; top:0; left:0; right:0; height:3px; z-index:1001; background:linear-gradient(90deg,#3b82f6,#8b5cf6,#ec4899,#f59e0b); }
#main-nav { position:fixed; top:3px; left:0; right:0; z-index:1000; background:rgba(10,13,20,0.92); backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px); border-bottom:1px solid rgba(255,255,255,0.07); height:54px; display:flex; align-items:center; }
.nav-inner { max-width:1536px; margin:0 auto; padding:0 20px; width:100%; display:flex; align-items:center; gap:0; }
.nav-brand { font-size:1rem; font-weight:900; text-decoration:none; background:linear-gradient(135deg,#60a5fa,#a78bfa); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; white-space:nowrap; margin-right:24px; flex-shrink:0; }
.nav-links { display:flex; align-items:center; gap:2px; overflow-x:auto; flex:1; min-width:0; position:relative; z-index:0; }
.nav-links::-webkit-scrollbar { display:none; }
.nav-link { display:inline-flex; align-items:center; gap:5px; padding:5px 11px; border-radius:8px; font-size:0.78rem; font-weight:600; text-decoration:none; color:#64748b; transition:all 0.15s; white-space:nowrap; border:1px solid transparent; }
.nav-link:hover { color:#e2e8f0; background:rgba(255,255,255,0.06); }
.nav-link.active { color:#60a5fa; background:rgba(59,130,246,0.1); border-color:rgba(59,130,246,0.25); }
.nav-right { display:flex; align-items:center; gap:8px; flex-shrink:0; margin-left:16px; position:relative; z-index:2; }
#lang-switcher { padding:4px 10px; border-radius:7px; background:rgba(255,255,255,0.05); color:#94a3b8; border:1px solid rgba(255,255,255,0.1); font-size:0.76rem; font-weight:700; cursor:pointer; transition:all 0.15s; font-family:inherit; }
#lang-switcher:hover { background:rgba(255,255,255,0.1); color:#e2e8f0; }
#nav-auth { display:flex; align-items:center; gap:6px; min-height:28px; }
#nav-mob-auth { display:flex; flex-direction:column; gap:4px; min-height:36px; }
#nav-user-nick { font-size:0.78rem; font-weight:700; color:#93c5fd; max-width:110px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-decoration:none; border-radius:6px; padding:2px 6px; transition:background 0.15s; }
#nav-user-nick:hover { background:rgba(59,130,246,0.12); }
#nav-logout-btn { padding:4px 10px; border-radius:7px; background:rgba(248,113,113,0.08); color:#f87171; border:1px solid rgba(248,113,113,0.2); font-size:0.74rem; font-weight:700; cursor:pointer; transition:all 0.15s; font-family:inherit; pointer-events:auto; position:relative; z-index:10; }
#nav-logout-btn:hover { background:rgba(248,113,113,0.18); }
#nav-login-btn { padding:5px 14px; border-radius:8px; background:rgba(59,130,246,0.15); color:#60a5fa; border:1px solid rgba(59,130,246,0.35); font-size:0.78rem; font-weight:700; cursor:pointer; text-decoration:none; transition:all 0.15s; display:inline-flex; align-items:center; gap:5px; }
#nav-login-btn:hover { background:rgba(59,130,246,0.28); }
