/* ====================================================================== */
/* === 타브증권 완전한 CSS - 깔끔하게 정리된 버전 === */
/* ====================================================================== */

/* 📦 폰트 및 기본 변수 설정 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&display=swap');

:root {
    /* 색상 시스템 */
    --bg-color: #ffffff;
    --secondary-bg: #f7f7f8;
    --panel-color: #ffffff;
    --border-color: #e9ecef;
    --text-primary: #1a1a1a;
    --text-secondary: #5a5a5a;
    --text-muted: #8a8a8a;

    /* 매매 색상 */
    --buy-color: #e64b4b;  /* 매수: 빨강 */
    --sell-color: #3182f6; /* 매도: 파랑 */
    --positive-text: var(--buy-color);
    --negative-text: var(--sell-color);

    /* 디자인 요소 */
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
    --border-radius: 12px;
}

/* 🎯 기본 레이아웃 설정 */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

a { 
    text-decoration: none; 
    color: inherit; 
}

#app-container {
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-color);
}

.page {
    display: none;
    padding: 32px;
    animation: fadeIn 0.3s ease-in-out;
    max-width: 1280px;
    margin: 0 auto;
}

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

#page-stock-detail.page {
    max-width: none;
    padding: 24px;
}

/* ================================================== */
/* === 📋 상단 네비게이션 === */
/* ================================================== */
.top-nav {
    display: flex; 
    align-items: center; 
    padding: 0 32px;
    background: var(--panel-color); 
    height: 60px; 
    flex-shrink: 0; 
    z-index: 10;
}

.logo-link { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

.logo-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.logo { 
    font-size: 24px; 
    color: #4361ee; 
}

.logo-text { 
    display: none !important; /* 이 속성을 추가하여 숨김 처리 */
    font-size: 18px; 
    font-weight: 700; 
}

.nav-links { 
    display: flex; 
    gap: 32px; 
    margin-left: 48px; 
}

.nav-links a { 
    font-weight: 500; 
    color: var(--text-secondary); 
}

.user-actions { 
    margin-left: auto; 
    display: flex; 
    align-items: center; 
    gap: 12px; 
}

/* 네비바 검색바 (클릭하면 모달 오픈) */
.nav-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 140px;
}
.nav-search-bar:hover {
    border-color: #adb5bd;
    background: var(--panel-color);
}
.nav-search-placeholder {
    font-size: 13px;
    color: #adb5bd;
    white-space: nowrap;
}

/* 프로필 이미지 + 드롭다운 */
.nav-profile-wrap {
    position: relative;
    display: flex;
    align-items: center;
    z-index: 10001;
}
.nav-profile-img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid #4361ee;
    transition: box-shadow 0.15s ease;
}
.nav-profile-img:hover {
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

/* 프로필 드롭다운 */
.profile-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 220px;
    background: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    z-index: 10001;
    overflow: hidden;
    animation: dropdownIn 0.15s ease-out;
}
.profile-dropdown.active {
    display: block;
}
@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
}
.dropdown-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #4361ee;
}
.dropdown-nickname {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.profile-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0 12px;
}
.profile-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    font-size: 14px;
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.12s ease;
    text-decoration: none;
}
.profile-dropdown-item:hover {
    background: var(--bg-color);
}
.profile-dropdown-item svg {
    color: #adb5bd;
}

/* ============================== */
/* 종목 검색 모달 */
/* ============================== */
.search-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10vh;
    backdrop-filter: blur(4px);
}
.search-modal-overlay.active {
    display: flex;
}
.search-modal {
    width: 580px;
    max-width: 92vw;
    background: var(--panel-color);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.22);
    overflow: hidden;
    animation: searchModalIn 0.18s ease-out;
}
@keyframes searchModalIn {
    from { opacity: 0; transform: translateY(-16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.search-modal-header {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}
.search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}
#search-modal-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-color);
    outline: none;
    font-family: inherit;
}
#search-modal-input::placeholder {
    color: #ced4da;
    font-weight: 400;
}
.search-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-color);
    color: #868e96;
    cursor: pointer;
    transition: all 0.12s ease;
    flex-shrink: 0;
}
.search-modal-close:hover {
    background: #dee2e6;
    color: var(--text-color);
}
.search-modal-body {
    max-height: 420px;
    overflow-y: auto;
    padding: 8px 12px 12px;
}
.search-empty-state {
    text-align: center;
    color: #868e96;
    font-size: 14px;
    padding: 48px 20px;
}
.search-result-section-label {
    font-size: 12px;
    font-weight: 600;
    color: #868e96;
    padding: 12px 8px 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.12s ease;
}
.search-result-item:hover,
.search-result-item.selected {
    background: var(--bg-color);
}
.search-result-img {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--bg-color);
    flex-shrink: 0;
}
.search-result-info {
    flex: 1;
    min-width: 0;
}
.search-result-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}
.search-result-ticker {
    font-size: 12px;
    color: #868e96;
    flex-shrink: 0;
    font-weight: 500;
}
.search-result-desc {
    font-size: 12px;
    color: #868e96;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
.search-result-price {
    text-align: right;
    flex-shrink: 0;
}
.search-result-price-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
}
.search-result-change {
    font-size: 12px;
    margin-top: 2px;
}
.search-result-change.up { color: var(--buy-color); }
.search-result-change.down { color: var(--sell-color); }
.search-result-change.flat { color: #868e96; }
.search-result-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}
.search-result-badge.index { background: #e8f4fd; color: #1971c2; }
.search-result-badge.etf { background: #fff3e0; color: #e65100; }
.search-result-badge.leveraged { background: #fce4ec; color: #c62828; }
.search-result-more {
    text-align: center;
    padding: 12px;
    font-size: 13px;
    color: #868e96;
    cursor: pointer;
}
.search-result-more:hover {
    color: #4361ee;
}

#connect-status-indicator { 
    display: flex; 
    align-items: center; 
    gap: 6px; 
    font-size: 13px; 
    font-weight: 500; 
}

.indicator-dot { 
    width: 8px; 
    height: 8px; 
    border-radius: 50%; 
}

.indicator-dot.connected { background-color: #28a745; }
.indicator-dot.disconnected { background-color: var(--buy-color); }

.btn-login {
    background-color: #4361ee; 
    color: white; 
    border: none; 
    padding: 8px 16px; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: 500;
}

/* ================================================== */
/* === 🔐 로그인 페이지 === */
/* ================================================== */
#page-login .login-container {
    max-width: 480px;
    margin: 10vh auto;
    text-align: center;
    background-color: var(--panel-color);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

#page-login h2 {
    font-size: 28px;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-primary);
}

#page-login .login-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

#page-login .login-form {
    margin-bottom: 32px;
}

#page-login .input-group {
    margin-bottom: 16px;
}

#page-login input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background-color: var(--bg-color);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

#page-login input:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

#page-login input::placeholder {
    color: var(--text-muted);
}

.btn-primary {
    width: 100%;
    background-color: #4361ee;
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-primary:hover {
    background-color: #3854d9;
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.signup-section {
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.signup-text {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 15px;
}

.signup-steps {
    background-color: var(--secondary-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: left;
}

.signup-steps h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.signup-steps ol {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary);
}

.signup-steps li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.signup-steps code {
    background-color: var(--panel-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 14px;
    color: #4361ee;
    border: 1px solid var(--border-color);
}

/* ================================================== */
/* === 📈 마켓 페이지 === */
/* ================================================== */
#page-market .market-container { 
    max-width: 1000px; 
    margin: 0 auto; 
}

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

.market-header h1 { 
    font-size: 28px; 
}

.market-header .market-status {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.market-status .status-title {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
}

.market-status .price-line {
    display: flex;
    align-items: center;
    gap: 6px;
}

.price-line #nasdaq-price {
    font-size: 18px;
    font-weight: 600;
}

.price-line #nasdaq-abs-change,
.price-line #nasdaq-pct-change {
    font-size: 14px;
    font-weight: 500;
}

#market-status-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.market-status #market-open-status {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

#market-status-dot.market-closed {
    background-color: var(--text-muted);
}

/* ▼▼▼ [프리마켓] 프리마켓 상태 도트 — 주황색 점멸 ▼▼▼ */
#market-status-dot.market-premarket {
    background-color: #f5a623;
    animation: premarket-pulse 2s ease-in-out infinite;
}
@keyframes premarket-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}
/* ▲▲▲ [프리마켓 끝] ▲▲▲ */

.market-list-header { 
    display: grid; 
    grid-template-columns: 3fr 2fr 2fr 2fr; 
    padding: 8px 16px; 
    color: var(--text-secondary); 
    font-size: 13px; 
    border-bottom: 1px solid var(--border-color); 
}

.market-list-header > span, 
.stock-row > div { 
    text-align: right; 
}

.market-list-header > span:first-child, 
.stock-row .col-name { 
    text-align: left; 
}

.market-list-body .stock-row { 
    display: grid; 
    grid-template-columns: 3fr 2fr 2fr 2fr; 
    align-items: center; 
    padding: 16px; 
    border-bottom: 1px solid var(--border-color); 
    cursor: pointer; 
    transition: background-color 0.2s; 
}

@media (hover: hover) and (pointer: fine) {
    .market-list-body .stock-row {
        transition: background-color 0.15s ease;
    }
    .market-list-body .stock-row:hover { 
        background-color: var(--secondary-bg); 
    }
}

@media (hover: none) {
    .market-list-body .stock-row:active {
        background-color: var(--secondary-bg);
    }
}

.stock-row .col-name { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
}

.stock-row .icon {
    width: 30px;
    height: 30px; 
    border-radius: 50px;
    background-color: var(--secondary-bg); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}

.stock-row .name-group .name { 
    font-weight: 600; 
    font-size: 14px;
}

.stock-row .name-group .ticker { 
    font-size: 11px; 
    color: var(--text-muted); 
}

.stock-row .col-price, 
.stock-row .col-change, 
.stock-row .col-volume { 
    font-weight: 500; 
    font-size: 13px;
}

/* ================================================== */
/* === 📊 주식 상세 페이지 === */
/* ================================================== */
#page-stock-detail .detail-container {
    display: flex; 
    gap: 24px; 
    padding: 0;
    height: calc(100vh - 60px - 64px);
}

#page-stock-detail .main-content {
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    min-width: 0; 
}

/* 주식 헤더 영역 */
#page-stock-detail .stock-header { 
    display: flex; 
    justify-content: space-between;
    align-items: center;
    gap: 16px; 
    margin-bottom: 16px; 
    flex-shrink: 0;
}
.stock-info-main {
    display: flex;
    align-items: center; /* 아이콘과 텍스트가 가로로 중앙 정렬되도록 */
    gap: 16px;
}


.stock-icon-large {
    width: 60px; 
    height: 60px; 
    border-radius: 4%; 
    background-color: var(--secondary-bg); 
    font-size: 16px; 
    font-weight: 700; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    overflow: hidden;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}

.icon[style*="background-image"]:empty,
.stock-icon-large[style*="background-image"]:empty {
    background-color: transparent;
}

.stock-info-large h1 { 
    font-size: 20px;
    font-weight: 700; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

.stock-ticker-large {
    display: inline-block;
    background-color: #1A1A1A;
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 2px;
    vertical-align: middle;
    margin-left: 4px;
}

.price-info { 
    display: flex; 
    align-items: center;
}

h1.stock-header-name {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

#stock-change.change-large {
    border-left: 1px solid #e9ecef; 
    padding-left: 14px; 
    margin-left: 14px; 
}

.current-price-large { 
    font-size: 22px;
    font-weight: 700; 
}

.change-large { 
    font-size: 16px;
    font-weight: 500; 
}

/* 차트 영역 */
#page-stock-detail .chart-area {
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    min-height: 0;
}

#page-stock-detail .chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-shrink: 0;
}

/* 차트 컨트롤 왼쪽 영역 */
.chart-controls-left {
    display: flex;
    flex-direction: row;
    gap: 16px;
    align-items: center;
}

.btn-stock-info {
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-stock-info:hover {
    background-color: #e9ecef;
}

/* 💼 PC용 거래정보 (개선된 형태) */
.stock-supply-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 8px;
    background-color: var(--secondary-bg);
    border-radius: 6px;
}

.stock-supply-info span:nth-of-type(2) {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.desktop-only {
    display: flex;
}

/* 시간프레임 선택기 */
#page-stock-detail .timeframe-selector { 
    display: flex; 
    gap: 8px; 
}

#page-stock-detail .timeframe-selector button { 
    padding: 6px 12px; 
    border: none; 
    background: transparent; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: 500; 
    color: var(--text-secondary); 
    transition: all 0.2s ease;
}

#page-stock-detail .timeframe-selector button.active { 
    background-color: var(--secondary-bg); 
    color: var(--text-primary); 
}

/* 드롭다운 메뉴 */
.dropdown { 
    position: relative; 
    display: inline-block; 
}

.dropdown-toggle { 
    position: relative; 
    padding-right: 20px !important; 
}

.dropdown-toggle::after {
    content: ''; 
    position: absolute; 
    right: 4px; 
    top: 50%;
    width: 0; 
    height: 0; 
    border-left: 4px solid transparent;
    border-right: 4px solid transparent; 
    border-top: 4px solid var(--text-secondary);
    transform: translateY(-50%);
}

.dropdown-menu {
    display: none; 
    position: absolute; 
    background-color: var(--panel-color);
    min-width: 80px; 
    box-shadow: var(--shadow); 
    z-index: 1000;
    border-radius: 8px; 
    border: 1px solid var(--border-color);
    top: 100%; 
    left: 0; 
    margin-top: 5px;
}

.dropdown-menu button {
    background: none; 
    border: none; 
    color: var(--text-secondary);
    padding: 8px 12px; 
    display: block; 
    width: 100%;
    text-align: left; 
    cursor: pointer; 
    font-size: 13px;
}

.dropdown-menu button:hover { 
    background-color: var(--secondary-bg); 
}

.dropdown:hover .dropdown-menu { 
    display: block; 
}

#page-stock-detail #chart-container { 
    flex-grow: 1; 
    width: 100%; 
    height: 100%; 
}

/* ================================================== */
/* === 🛒 오른쪽 사이드바 (거래 및 주문) === */
/* ================================================== */
#page-stock-detail .right-sidebar {
    flex: 0 0 320px; 
    display: flex; 
    flex-direction: column; 
    gap: 16px;
}

/* 보유 주식 상세 정보 */
.owned-stock-details-section { 
    background-color: var(--secondary-bg); 
    border-radius: var(--border-radius); 
    padding: 16px; 
}

.owned-stock-details-section h2 { 
    font-size: 16px; 
    margin-bottom: 12px; 
}

.owned-stock-details-section .info-group { 
    padding: 4px 0; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.owned-stock-details-section .value { 
    font-size: 20px; 
    font-weight: 600; 
}

.owned-stock-details-section .change { 
    font-size: 14px; 
    font-weight: 500; 
}

.owned-stock-details-section .info-group-small { 
    display: flex; 
    justify-content: space-between; 
    font-size: 13px; 
    color: var(--text-secondary); 
    margin-top: 8px; 
}

.owned-stock-details-section .info-group-small span:last-child { 
    color: var(--text-primary); 
    font-weight: 500; 
}

/* 주문 섹션 */
.order-section { 
    background-color: var(--panel-color); 
    border-radius: var(--border-radius); 
    border: 1px solid var(--border-color); 
    padding: 16px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease;
}

.trade-tabs { 
    display: flex; 
    border-bottom: 1px solid var(--border-color); 
}

.trade-tab { 
    flex: 1; 
    text-align: center; 
    padding: 12px 0; 
    font-weight: 600; 
    color: var(--text-muted); 
    cursor: pointer; 
    position: relative; 
    border: none; 
    background: transparent; 
}

.trade-tab.active { 
    color: var(--text-primary); 
}

.trade-tab.active::after { 
    content: ''; 
    position: absolute; 
    bottom: -1px; 
    left: 0; 
    width: 100%; 
    height: 2px; 
    background-color: var(--text-primary); 
}

.order-type { 
    margin-top: 16px; 
}

.order-section .input-group { 
    margin-top: 16px; 
}

.order-section input, 
.order-type-select { 
    width: 100%; 
    padding: 12px; 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    font-size: 16px; 
    text-align: left;
    background-color: white; 
}

.order-section input:disabled { 
    background-color: var(--secondary-bg); 
}

.order-info { 
    margin-top: 16px; 
    font-size: 13px; 
}

.order-info .info-group { 
    padding: 6px 0; 
    display: flex; 
    justify-content: space-between; 
    color: var(--text-secondary); 
}

.order-info .info-group span:last-child { 
    color: var(--text-primary); 
    font-weight: 500; 
}

.button-group { 
    margin-top: 16px; 
}

.button-group button {
    width: 100%; 
    padding: 14px; 
    border: none; 
    border-radius: 8px; 
    color: white; 
    font-size: 16px; 
    font-weight: 700; 
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.button-group button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.button-group button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.button-group button.buy { 
    background-color: var(--buy-color); 
}

.button-group button.sell { 
    background-color: var(--sell-color); 
}

.button-group button:disabled { 
    background-color: var(--text-muted); 
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 주문 내역 섹션 */
.order-history-section {
    margin-top: 16px;
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.history-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.history-tab {
    flex: 1;
    padding: 12px 0;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    border: none;
    background: transparent;
    font-size: 14px;
}

.history-tab.active {
    color: var(--text-primary);
}

.history-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
}

.order-list-container {
    padding: 8px;
    max-height: 250px;
    overflow-y: auto;
}

.order-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.order-list-item:hover {
    background-color: var(--secondary-bg);
}

.order-info-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-info-group .type-price {
    font-weight: 600;
    font-size: 14px;
}

.order-info-group .type-buy { color: var(--buy-color); }
.order-info-group .type-sell { color: var(--sell-color); }
.type-sell-profit { color: var(--buy-color); }
.type-sell-loss { color: var(--sell-color); }

.order-info-group .qty-time {
    font-size: 12px;
    color: var(--text-muted);
}

.order-actions .btn-cancel {
    background-color: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.order-actions .btn-cancel:hover {
    background-color: var(--text-muted);
    color: white;
}

.order-list-container .empty-message {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ================================================== */
/* === 📊 포트폴리오 페이지 === */
/* ================================================== */

/* 메인 레이아웃 */
.portfolio-layout {
    display: flex;
    min-height: calc(100vh - 60px);
    max-width: 1400px;
    margin: 0 auto;
    gap: 24px;
    padding: 0;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 32px 0 32px 32px;
}

/* 전체 자산 카드 */
.overview-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 24px;
    padding: 40px;
    color: white;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.25);
}

.asset-title {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 8px;
    font-weight: 400;
}

.total-amount {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.change-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
}

/* 컨텐츠 표시/숨김 */
.content-section {
    display: none;
    flex-direction: column;
    gap: 20px;
}

.content-section.active {
    display: flex;
}

/* 개별 카드 스타일 */
.section-card, .account-card, .chart-card, .trade-summary, .trade-list {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 단순 요약 카드 스타일 */
.simple-summary {
    padding: 24px !important;
}

.summary-title {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.summary-amount {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.summary-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.summary-grid > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.summary-grid > div span:first-child {
    color: var(--text-muted);
    font-size: 14px;
}

.summary-grid > div span:last-child {
    font-weight: 500;
    font-size: 16px;
}

/* 자산 현황 - 자산 요약 */
.asset-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.summary-item {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.summary-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.summary-value {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.summary-change {
    font-size: 13px;
    font-weight: 500;
}

/* 계좌별 구분 */
.account-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.account-item {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

.account-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.account-amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

/* 차트 영역 */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.chart-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.period-selector {
    display: flex;
    gap: 4px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 4px;
}

.period-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 50px;
}

.period-btn.active, .period-btn:hover {
    background: #4361ee;
    color: white;
}

/* 포트폴리오 페이지의 차트에만 배경색이 적용되도록 선택자 수정 */
#page-portfolio .chart-area {
    background: #fafafa;
    border-radius: 16px;
    height: 280px;
    min-height: 280px;
}

/* ========== 자산 추이 차트 - 토스 스타일 ========== */
.asset-chart-card {
    padding: 0 !important;
    overflow: hidden;
}

.asset-chart-header {
    padding: 20px 20px 12px;
}

.asset-chart-info {
    margin-bottom: 16px;
}

.asset-chart-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary, #191F28);
    letter-spacing: -0.5px;
}

.asset-chart-change {
    font-size: 14px;
    font-weight: 500;
    margin-top: 2px;
    color: var(--text-secondary, #8B95A1);
}

.asset-chart-change.positive { color: #F04452; }
.asset-chart-change.negative { color: #3182F6; }

.asset-period-tabs {
    display: flex;
    gap: 4px;
    background: #F2F4F6;
    border-radius: 10px;
    padding: 3px;
}

.asset-period-btn {
    flex: 1;
    padding: 7px 0;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #8B95A1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.asset-period-btn.active {
    background: white;
    color: #191F28;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.asset-period-btn:hover:not(.active) {
    color: #4E5968;
}

.asset-chart-area {
    height: 220px !important;
    min-height: 220px !important;
    background: white !important;
    border-radius: 0 !important;
    padding: 0 !important;
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
}

/* 크로스헤어 툴팁 */
.asset-chart-area .tv-lightweight-charts {
    border-radius: 0 !important;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .asset-chart-header {
        padding: 16px 16px 10px;
    }
    .asset-chart-title {
        font-size: 22px;
    }
    .asset-chart-area {
        height: 180px !important;
        min-height: 180px !important;
    }
    .asset-period-btn {
        font-size: 12px;
        padding: 6px 0;
    }
}

/* 보유 주식 */
.stock-controls {
    display: flex;
    gap: 8px;
}

.sort-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-btn.active {
    background: var(--text-primary);
    color: white;
    border-color: var(--text-primary);
}

.stock-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stock-item {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* transition은 hover capable 기기에서만 */
    cursor: pointer;
}

/* PC: hover 가능한 기기에서만 호버 효과 */
@media (hover: hover) and (pointer: fine) {
    .stock-item {
        transition: background 0.15s ease, box-shadow 0.15s ease;
    }
    .stock-item:hover {
        background: white;
        box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    }
}

/* 모바일: tap 시 active 효과 */
@media (hover: none) {
    .stock-item:active {
        background: #eff0f1;
    }
}

.stock-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stock-icon-small {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--secondary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.stock-details .name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.stock-details .sub {
    font-size: 13px;
    color: var(--text-secondary);
}

.stock-value {
    text-align: right;
}

.stock-amount {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.stock-profit {
    font-size: 13px;
    font-weight: 500;
}

/* 수익분석 */
.profit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.profit-item {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.profit-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.profit-value {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profit-rate {
    font-size: 13px;
    font-weight: 500;
}

/* 거래내역 요약 */
.trade-total-label {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
    text-align: center;
}

.trade-total-amount {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
}

.trade-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
}

.breakdown-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.breakdown-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.breakdown-value {
    font-size: 16px;
    font-weight: 600;
}

/* 거래내역 리스트 */
.order-list-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.order-list-container::-webkit-scrollbar {
    width: 6px;
}

.order-list-container::-webkit-scrollbar-track {
    background: var(--secondary-bg);
    border-radius: 3px;
}

.order-list-container::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.order-list-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-list-item:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

/* 우측 세로 메뉴 */
.sidebar-menu {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
    padding: 32px 32px 32px 0;
}

.menu-item {
    background: white;
    border-radius: 16px;
    padding: 20px 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    border: 2px solid transparent;
}

.menu-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.menu-item.active {
    border-color: #4361ee;
    box-shadow: 0 4px 20px rgba(67, 97, 238, 0.15);
}

.menu-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.menu-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 8px;
}

.menu-badge {
    display: inline-block;
    background: #f1f3f5;
    color: #495057;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
}

.menu-badge.positive { background: #fff5f5; color: #e64b4b; }
.menu-badge.negative { background: #f0f8ff; color: #3182f6; }

/* ================================================== */
/* === 📊 자산 비중 막대 바 === */
/* ================================================== */
.portfolio-distribution-container {
    margin-bottom: 12px;
}

.distribution-bar {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 16px;
    background-color: var(--secondary-bg);
}

.bar-segment {
    height: 100%;
    transition: width 0.3s ease-in-out;
}

.distribution-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    font-size: 13px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-name {
    color: var(--text-secondary);
}

.legend-percent {
    font-weight: 600;
    color: var(--text-primary);
}

/* 실현 손익 정렬 및 리스트 */
.sort-controls {
    display: flex;
    gap: 8px;
}

.sort-controls button {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background-color: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-controls button.active,
.sort-controls button:hover {
    background-color: var(--text-primary);
    color: white;
    border-color: var(--text-primary);
}

.trade-summary-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: 16px;
}

.trade-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 12px;
}

.trade-summary-item .stock-name {
    font-weight: 600;
}

.trade-summary-item .profit-value {
    font-weight: 500;
    font-size: 14px;
}

/* ================================================== */
/* === 📅 기간별 판매수익 (분석 섹션) === */
/* ================================================== */
.period-navigator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 24px;
}

.period-toggle {
    display: flex;
    background-color: #e9ecef;
    border-radius: 8px;
    padding: 4px;
}

.toggle-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn.active {
    background-color: white;
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.date-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.arrow-btn {
    background-color: transparent;
    border: none;
    font-size: 20px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 8px;
    border-radius: 4px;
}

.arrow-btn:hover {
    background-color: #e9ecef;
}

.arrow-btn:disabled {
    color: #ced4da;
    cursor: not-allowed;
    background-color: transparent;
}

.date-display {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    width: 180px;
    text-align: center;
}

/* ================================================== */
/* === 🔍 종목정보 모달 === */
/* ================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--panel-color);
    padding: 24px 32px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 480px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.visible .modal-content {
    transform: translateY(0);
}

.modal-content h2 {
    font-size: 22px;
    margin-bottom: 24px;
    text-align: center;
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
}

.info-section {
    margin-bottom: 24px;
}

.info-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background-color: var(--secondary-bg);
    padding: 12px;
    border-radius: 8px;
}

.metric-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.metric-value {
    font-size: 18px;
    font-weight: 600;
}

.composition-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.composition-item .composition-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
}

.composition-item .label-name {
    color: var(--text-secondary);
}

.composition-item .label-percent {
    font-weight: 600;
}

.composition-bar-bg {
    background-color: var(--secondary-bg);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.composition-bar-fg {
    background-color: #4361ee;
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* 도넛 차트 컨테이너 */
.composition-chart-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
    min-height: 220px;
}

.composition-legend-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.composition-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.composition-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.composition-legend-label {
    color: var(--text-secondary);
}

.composition-legend-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* ================================================== */
/* === 🎨 공통 컴포넌트 === */
/* ================================================== */

/* 색상 클래스 */
.positive, .positive-text { 
    color: var(--positive-text) !important; 
}

.negative, .negative-text { 
    color: var(--negative-text) !important; 
}

/* 빈 상태 메시지 */
.empty-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* 알림 시스템 */
.notification {
    position: fixed !important; 
    top: 80px; 
    right: 24px; 
    padding: 16px 24px;
    border-radius: 8px; 
    color: white !important; 
    font-size: 14px; 
    font-weight: 500;
    z-index: 99999 !important; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateX(120%); 
    opacity: 0;
    transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
    pointer-events: none; 
    max-width: 300px; 
    word-wrap: break-word;
}

.notification.success { 
    background-color: #28a745; 
}

.notification.error { 
    background-color: #dc3545; 
}

/* ================================================== */
/* === 📱 반응형 디자인 (모바일 최적화) === */
/* ================================================== */
@media (max-width: 768px) {
    body { 
        overflow: auto; 
    }

    .top-nav { 
        height: 50px; 
        padding: 0 16px; 
    }

    /* 🔥 모바일 여백 및 폰트 크기 조정 */
    .page { 
        padding: 8px; 
    }

    .section-card, .chart-card {
        padding: 16px;
    }

    .main-content {
        padding: 8px;
    }

    .logo-text { 
        display: none; 
    }

    .nav-links { 
        margin-left: 24px; 
        gap: 20px; 
    }

    .nav-search-bar {
        min-width: unset;
        padding: 8px 10px;
    }
    .nav-search-placeholder {
        display: none;
    }
    .profile-dropdown {
        right: -8px;
        width: 200px;
    }

    /* 🔐 로그인 페이지 모바일 조정 */
    #page-login .login-container {
        margin: 5vh 16px;
        padding: 24px;
    }

    #page-login h2 {
        font-size: 24px;
    }

    /* 📊 주식 상세 페이지 모바일 레이아웃 */
    #page-stock-detail.page {
        padding: 0;
    }

    #page-stock-detail .detail-container { 
        flex-direction: column; 
        height: auto; 
        gap: 0; 
    }

    #page-stock-detail .main-content {
        flex: none; 
        width: 100%;
    }

    #page-stock-detail .stock-header {
        background: none; 
        border: none; 
        border-radius: 0;
        border-bottom: 1px solid var(--border-color);
        padding: 16px; 
        margin-bottom: 0;
    }

    .stock-icon-large { 
        width: 44px; 
        height: 44px; 
        font-size: 16px; 
    }

    .stock-info-large h1 { 
        font-size: 18px; 
    }

    .stock-ticker-large { 
        font-size: 14px; 
    }

    .current-price-large { 
        font-size: 24px; 
    }

    .change-large { 
        font-size: 14px; 
    }

    /* 🔥 모바일 차트 영역 개선 */
    #page-stock-detail .chart-area {
        height: 350px; 
        background: none; 
        border: none;
        border-radius: 0; 
        padding: 0;
        margin-top: 0;
    }

    /* 🔥 모바일 차트 헤더 수정 - 주식정보 버튼을 시간프레임과 같은 줄에 배치 */
    #page-stock-detail .chart-header {
        padding: 4px 16px;
        padding-top: 16px;
        flex-direction: row; /* 가로 배치로 변경 */
        justify-content: space-between; /* 양쪽 끝으로 정렬 */
        align-items: center; /* 세로 중앙 정렬 */
        margin-bottom: 4px;
        gap: 8px; /* 적절한 간격 */
    }

    /* 🔥 모바일에서 차트 컨트롤 왼쪽을 간소화 */
    .chart-controls-left {
        flex-direction: row;
        gap: 8px;
        align-items: center;
    }

    /* 🔥 모바일에서 거래정보 숨김 */
    .stock-supply-info.desktop-only {
        display: none !important;
    }

    .timeframe-selector {
        flex-shrink: 0; /* 시간프레임 선택기가 줄어들지 않도록 */
    }

    #page-stock-detail #chart-container {
        width: 100% !important;
        height: 100% !important;
    }

    #page-stock-detail .right-sidebar {
        width: 100%; 
        flex: none; 
        padding: 0 16px 16px 16px;
    }

    .order-section, .owned-stock-details-section {
        border-left: none; 
        border-right: none; 
        border-radius: 0;
    }

    /* 📊 포트폴리오 모바일 레이아웃 */
    .portfolio-layout {
        flex-direction: column;
        padding: 0;
    }

    .sidebar-menu {
        order: -1;
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        gap: 8px;
        padding: 8px;
        position: relative;
    }

    /* 🔥 모바일 메뉴 설명 숨김 및 스크롤 힌트 강화 */
    .sidebar-menu .menu-description {
        display: none;
    }

    .sidebar-menu::after {
        content: '〉';
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        font-size: 24px;
        font-weight: bold;
        color: #cccccc;
        background: linear-gradient(to right, transparent 0%, white 50%, white 100%);
        padding: 10px 8px 10px 20px;
        pointer-events: none;
    }

    .sidebar-menu::-webkit-scrollbar { display: none; }
    .sidebar-menu { -ms-overflow-style: none; scrollbar-width: none; }

    /* ▼▼▼ [버그 수정] 끝까지 스크롤하면 화살표 숨김 ▼▼▼ */
    .sidebar-menu.scrolled-end::after {
        display: none;
    }
    /* ▲▲▲ [버그 수정 끝] ▲▲▲ */

    .menu-item {
        min-width: 120px;
        padding: 12px 16px;
    }

    .total-amount, .summary-amount {
        font-size: 28px;
    }

    .asset-summary, .profit-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .account-grid {
        grid-template-columns: 1fr;
    }

    .chart-area {
        height: 250px;
        min-height: 250px;
    }

    .desktop-only {
        display: none !important;
    }

    .basic-info-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .composition-chart-container {
        min-height: 180px;
    }

    #composition-donut-chart {
        width: 160px !important;
        height: 160px !important;
    }
}
/* style.css */
/* ================================================== */
/* === 📢 광고 배너 (최종 개선 버전) === */
/* ================================================== */
.ad-banner-container {
    display: flex;
    gap: 24px;
    width: 100%;
    margin-bottom: 24px;
    align-items: stretch;
}

/* 메인 배너 (슬라이드) */
.ad-main-banner {
    flex: 3;
    aspect-ratio: 4 / 1;
    min-width: 0;
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--secondary-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: grab;
    user-select: none;
}

.ad-main-banner.dragging {
    cursor: grabbing;
}

.ad-slides {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}

.ad-slides.no-transition {
    transition: none;
}

.ad-slide {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.ad-slide a, .ad-side-banner a {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

.ad-slide img, .ad-side-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 화살표 버튼 (임시 숨김) */
.ad-arrow {
    display: none !important;
}

.ad-dots {
    position: absolute;
    bottom: 16px;
    left: 20px;
    display: flex;
    gap: 10px;
    padding: 10px 16px;

    /* 단순 블러 효과 */
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 24px;
}

.ad-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.ad-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

.ad-dot.active {
    background: rgba(255, 255, 255, 1);
    width: 24px;
    border-radius: 4px;
}
/* PC 전용 서브 배너 */
.ad-side-banner {
    flex: 1;
    aspect-ratio: 4 / 1;
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--secondary-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 모바일 화면 (768px 이하) */
@media (max-width: 768px) {
    .ad-banner-container {
        flex-direction: column;
        gap: 16px;
    }

    .ad-main-banner {
        flex: none;
        width: 100%;
        height: 0;
        padding-bottom: 25%;
        position: relative;
    }

    .ad-main-banner .ad-slides {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    .ad-main-banner .ad-dots {
        position: absolute;
        bottom: 12px;
        left: 12px;
        transform: none;
        z-index: 10;
        padding: 8px 14px;
        gap: 8px;
    }

    .ad-dot {
        width: 8px;
        height: 8px;
    }

    .ad-dot.active {
        width: 20px;
    }

    .ad-side-banner {
        display: none !important;
    }
}
/* ================================================== */
/* === 📱 모바일에서 배너 표시 수정 === */
/* ================================================== */
@media screen and (max-width: 768px) {
    .ad-banner-container {
        flex-direction: column;
        gap: 12px;
    }

    .ad-main-banner {
        flex: none;
        width: 100%;
        aspect-ratio: 2.5 / 1; /* 모바일에서는 세로 공간 확보 */
        min-height: 120px;     /* 높이 0 방지 */
        display: block !important; /* 혹시 display:none 남아있는 경우 방지 */
    }

    .ad-main-banner img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* 모바일에서는 사이드 배너 숨김 */
    .ad-side-banner {
        display: none !important;
    }

    /* 점 네비게이터 보이도록 */
    .ad-dots {
        position: absolute;
        bottom: 8px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        gap: 6px;
    }

    .ad-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: rgba(255,255,255,0.5);
    }

    .ad-dot.active {
        background-color: #fff;
    }
}
/* 드래그 중엔 링크 클릭/탭 비활성화 */
.ad-main-banner.dragging a {
  pointer-events: none !important;
}

/* 수평 스와이프는 우리가 처리, 세로 스크롤은 허용 */
.ad-main-banner, .ad-slides, .ad-slide {
  touch-action: pan-y;
}

/* 이미지 끌기/선택 금지(고스트 드래그 방지) */
.ad-slides img {
  -webkit-user-drag: none;
  user-select: none;
}

/* ================================================== */
/* === 📰 뉴스 페이지 === */
/* ================================================== */
#page-news .news-container {
    max-width: 900px;
    margin: 0 auto;
}

#page-news h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
}

.news-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 24px 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

/* [수정] 뉴스 아이템 호버 시 배경색 변경 및 전체 클릭 가능하도록 */
#page-news .news-list-container .news-item {
    padding: 20px;
    border-radius: 12px;
    border: none;
    border-bottom: 1px solid var(--border-color); /* 구분선 유지 */
}

#page-news .news-list-container .news-item:hover {
    background-color: var(--secondary-bg);
}

.news-item:hover .news-item-title {
    color: var(--sell-color); /* 파란색으로 변경 */
}

.news-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.news-item-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.5;
    /* 긴 제목 자르기 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.news-item-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: auto; /* 메타데이터를 항상 하단에 고정 */
}

.news-item-press {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.news-item-time {
    font-size: 13px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.news-item-thumbnail {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    object-fit: cover;
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* 뉴스 모달 스타일 */
#news-modal .modal-content {
    max-width: 640px; /* 주식 정보 모달보다 넓게 */
}

#modal-news-image {
    width: 100%;
    height: 200px; /* 이미지 높이 고정 */
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 24px;
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
}

.news-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

#modal-news-press {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

#modal-news-time {
    font-size: 13px;
    color: var(--text-muted);
}

#modal-news-title {
    font-size: 24px;
    font-weight: 700;
    margin: 8px 0 20px 0;
    line-height: 1.4;
}

#modal-news-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap; /* \n 줄바꿈 적용 */
}

#modal-news-ticker {
    margin-top: 24px;
    display: inline-block; /* JS로 표시/숨김 제어 */
}

/* 모바일에서 뉴스 썸네일 크기 조정 */
@media (max-width: 768px) {
    #page-news .news-container {
        padding: 0 16px; /* 모바일 좌우 여백 */
    }
    .news-item {
        padding: 16px 0;
        gap: 16px;
    }
    #page-news .news-list-container .news-item {
        padding: 16px; /* 모바일 패딩 */
    }
    .news-item-thumbnail {
        width: 80px;
        height: 80px;
    }
    .news-item-title {
        font-size: 16px;
        margin-bottom: 8px;
        -webkit-line-clamp: 3; /* 모바일에선 3줄 */
    }
    .news-item-meta {
        gap: 8px;
    }
    .news-item-press, .news-item-time {
        font-size: 12px;
    }
    /* 모바일에서 티커는 숨김 (공간 확보) */
    .news-item .stock-ticker-large {
        display: none;
    }

    #modal-news-title {
        font-size: 20px;
    }


/* ⬇️ [수정] 모바일에서 모달 오버플로우 방지 ⬇️ */
    .modal-content {
        width: 95%; /* 모바일에서 폭을 조금 더 확보 */
        max-height: 85vh; /* 화면 높이의 85%로 최대 높이 제한 */
        overflow-y: auto; /* 내용이 넘칠 경우 모달 *내부* 스크롤 활성화 */
        padding: 24px 16px; /* 모바일 좌우 패딩 조정 */
    }

    #news-modal .modal-content {
        max-width: none; /* 모바일에서는 640px max-width 제한 해제 */
    }

    .modal-close-btn {
        top: 10px;
        right: 10px; /* X 버튼 위치 미세 조정 */
    }
    /* ⬆️ [수정] 모바일에서 모달 오버플로우 방지 ⬆️ */

/* ❗️참고: 이 괄호(})는 @media 블록의 닫는 괄호입니다. */
}

/* 호가창 스타일 */
.order-book-container {
    display: flex;
    flex-direction: column;
    height: 400px;
    font-size: 13px;
}

.order-book-asks {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* 아래로 정렬 */
    overflow: hidden;
}

.order-book-bids {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
}

.ob-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    cursor: pointer;
    position: relative;
}

.ob-row:hover { background-color: #f5f5f5; }

.ob-ask .ob-price { color: var(--sell-color); font-weight: bold; }
.ob-bid .ob-price { color: var(--buy-color); font-weight: bold; }

.ob-qty { z-index: 1; position: relative; color: #555; }
.ob-price { z-index: 1; position: relative; width: 80px; text-align: right; }

.ob-bar {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    opacity: 0.15;
}
.ob-ask .ob-bar { background-color: var(--sell-color); }
.ob-bid .ob-bar { background-color: var(--buy-color); }

/* style.css 맨 아래에 추가하세요 */

/* === 📊 호가창 (사이드바 삽입용) === */
.order-book-panel {
    background-color: var(--panel-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 16px; /* 아래쪽 여백 */
    display: flex;
    flex-direction: column;
    /* 높이는 내용물에 따라 늘어나거나 고정 */
    min-height: 400px; 
}

.order-book-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.order-book-header h3 {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
}

.unit-text {
    font-size: 11px;
    color: var(--text-muted);
}

.order-book-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0;
    font-size: 12px;
    position: relative;
}

/* 호가 행 공통 스타일 */
.ob-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    position: relative;
    height: 28px; /* 행 높이 고정 */
    transition: background-color 0.1s;
}

.ob-row:hover {
    background-color: var(--secondary-bg);
}

/* 가격과 수량 텍스트 (바 위에 떠야 함) */
.ob-price, .ob-qty {
    z-index: 2;
    position: relative;
}

.ob-price {
    font-weight: 600;
    width: 40%;
    text-align: left;
}

.ob-qty {
    width: 40%;
    text-align: right;
    color: var(--text-secondary);
}

/* 배경 그래프 바 */
.ob-bar {
    position: absolute;
    top: 2px;
    bottom: 2px;
    right: 0;
    z-index: 1;
    opacity: 0.15;
    border-radius: 4px 0 0 4px;
    transition: width 0.2s ease;
}

/* 매도 호가 (Asks) - 파랑 */
.order-book-asks {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* 아래쪽(현재가 쪽)으로 정렬 */
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.ob-ask .ob-price { color: var(--sell-color); }
.ob-ask .ob-bar { background-color: var(--sell-color); }

/* 매수 호가 (Bids) - 빨강 */
.order-book-bids {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* 위쪽(현재가 쪽)으로 정렬 */
    padding-top: 4px;
    border-top: 1px solid var(--border-color);
}

.ob-bid .ob-price { color: var(--buy-color); }
.ob-bid .ob-bar { background-color: var(--buy-color); }

/* 중앙 현재가 표시 */
.order-book-current {
    text-align: center;
    padding: 8px 0;
    font-weight: 800;
    font-size: 16px;
    color: var(--text-primary);
    background-color: var(--secondary-bg);
    margin: 2px 0;
    border-radius: 4px;
}

/* ▼▼▼ [수정] 매수/매도 비율 바 (토스 스타일) ▼▼▼ */
.ob-ratio-bar {
    display: flex;
    height: 32px;
    margin: 8px 0 12px 0;
    border-radius: 6px;
    overflow: hidden;  /* [복원] 둥근 모서리 유지 */
    background: var(--secondary-bg, #f0f0f0);
    font-size: 12px;
    position: relative;  /* [추가] 레이블 absolute 기준 */
}

/* 판매대기 (파란색 - 왼쪽) */
.ob-ratio-ask {
    background: var(--sell-color, #3182f6);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 10px;
    transition: width 0.3s ease;
    width: 50%;
}

/* 구매대기 (빨간색 - 오른쪽) */
.ob-ratio-bid {
    background: var(--buy-color, #e64b4b);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    transition: width 0.3s ease;
    width: 50%;
}

/* [수정] 레이블을 absolute로 띄워서 항상 보이게 */
.ob-ratio-ask-label {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    z-index: 10;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.ob-ratio-bid-label {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    z-index: 10;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.ob-ratio-ask-label strong,
.ob-ratio-bid-label strong {
    font-weight: 700;
    margin: 0 4px;
}
/* ▲▲▲ [수정 끝] ▲▲▲ */

/* ============================================================================
   style.css 끝에 추가 - 미체결 주문 목록 스타일
   ============================================================================ */

/* 미체결 주문 섹션 */
.order-history-section {
    margin-top: 16px;
    background: var(--card-bg, #1a1a2e);
    border-radius: 8px;
    overflow: hidden;
}

.history-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color, #2a2a4a);
}

.history-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-tab.active {
    color: var(--text-primary, #fff);
    background: var(--bg-secondary, #252540);
    border-bottom: 2px solid var(--accent-color, #6366f1);
}

.history-tab:hover:not(.active) {
    background: var(--bg-hover, #20203a);
}

/* 주문 목록 컨테이너 */
.order-list-container {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
}

/* 개별 주문 아이템 */
.order-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--bg-secondary, #252540);
    border-radius: 6px;
    border-left: 3px solid;
    position: relative;
}

.order-item.buy {
    border-left-color: var(--positive, #22c55e);
}

.order-item.sell {
    border-left-color: var(--negative, #ef4444);
}

.order-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-action {
    font-weight: 600;
    font-size: 13px;
}

.order-action.buy {
    color: var(--positive, #22c55e);
}

.order-action.sell {
    color: var(--negative, #ef4444);
}

.order-type-badge {
    font-size: 10px;
    color: var(--text-secondary, #888);
    padding: 2px 6px;
    background: var(--bg-tertiary, #1a1a2e);
    border-radius: 4px;
}

.order-status {
    font-size: 11px;
    color: #f0ad4e;
}

.order-qty {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary, #fff);
}

.order-price {
    font-size: 12px;
    color: var(--text-secondary, #888);
}

.order-time {
    font-size: 11px;
    color: var(--text-tertiary, #666);
    margin-left: auto;
}

/* 취소 버튼 */
.btn-cancel {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px 10px;
    font-size: 11px;
    background: var(--negative, #ef4444);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-cancel:hover {
    opacity: 0.8;
}

/* 빈 메시지 */
.order-list-container .empty-message {
    text-align: center;
    color: var(--text-tertiary, #666);
    padding: 20px;
    font-size: 13px;
}

/* 스크롤바 스타일 */
.order-list-container::-webkit-scrollbar {
    width: 4px;
}

.order-list-container::-webkit-scrollbar-track {
    background: var(--bg-secondary, #252540);
}

.order-list-container::-webkit-scrollbar-thumb {
    background: var(--border-color, #2a2a4a);
    border-radius: 2px;
}

.order-list-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary, #666);
}
/* ============================================================================
   style_fixes.css - 기존 style.css에 추가/수정할 스타일
   ============================================================================ */

/* ================================================== */
/* === 1. 드롭다운 메뉴 수정 (클릭 기반으로 변경) === */
/* ================================================== */

/* 기존 hover 방식 비활성화 (style.css 660번줄 덮어쓰기) */
.dropdown:hover .dropdown-menu { 
    display: none; /* hover로 열지 않음 */
}

/* 클릭으로 열릴 때 (JS에서 .open 클래스 추가) */
.dropdown.open .dropdown-menu {
    display: block !important;
}

/* 드롭다운 메뉴 z-index 및 위치 보정 */
.dropdown-menu {
    z-index: 9999 !important;
    pointer-events: auto;
}

/* 드롭다운 토글 버튼 스타일 개선 */
.dropdown-toggle {
    cursor: pointer;
    user-select: none;
}

/* 드롭다운 열림 상태 시각적 표시 */
.dropdown.open .dropdown-toggle::after {
    border-top: none;
    border-bottom: 4px solid var(--text-secondary);
}


/* ================================================== */
/* === 2. 우측 사이드바 스크롤 추가 === */
/* ================================================== */

#page-stock-detail .right-sidebar {
    flex: 0 0 320px; 
    display: flex; 
    flex-direction: column; 
    gap: 16px;

    /* 스크롤 추가 */
    max-height: calc(100vh - 80px); /* 상단 네비게이션 높이 제외 */
    overflow-y: auto;
    overflow-x: hidden;

    /* 스크롤바 스타일 */
    scrollbar-width: thin;
    scrollbar-color: var(--border-color, #2a2a4a) transparent;

    /* 패딩 조정 */
    padding-right: 8px;
    padding-bottom: 24px;
}

/* Webkit 스크롤바 스타일 */
#page-stock-detail .right-sidebar::-webkit-scrollbar {
    width: 6px;
}

#page-stock-detail .right-sidebar::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

#page-stock-detail .right-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color, #2a2a4a);
    border-radius: 3px;
}

#page-stock-detail .right-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted, #666);
}

/* 모바일에서 사이드바 */
@media (max-width: 1024px) {
    #page-stock-detail .right-sidebar {
        max-height: none !important;
        overflow-y: visible !important;
        overflow: visible !important;
        height: auto !important;
    }
}


/* ================================================== */
/* === 3. 미체결/거래내역 섹션 디자인 개선 === */
/* ================================================== */

/* 주문 내역 섹션 - 테마 색상 통일 */
.order-history-section {
    margin-top: 16px;
    background-color: var(--secondary-bg, #1e1e2e);
    border: 1px solid var(--border-color, #2d2d3d);
    border-radius: var(--border-radius, 12px);
    overflow: visible; /* ▼▼▼ [수정] hidden → visible (내부 콘텐츠 보이도록) ▼▼▼ */
}

/* ▼▼▼ [신규] section-content 명시적 스타일 ▼▼▼ */
.order-history-section .section-content {
    display: block;
    min-height: 100px;
}

/* 탭 스타일 개선 */
.history-tabs {
    display: flex;
    background-color: var(--panel-color, #252535);
    border-bottom: 1px solid var(--border-color, #2d2d3d);
    min-height: 44px; /* ▼▼▼ [수정] 최소 높이 보장 ▼▼▼ */
}

.history-tab {
    flex: 1;
    padding: 12px 0;
    text-align: center;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-muted, #888);
    cursor: pointer;
    position: relative;
    border: none;
    background: transparent;
    transition: color 0.2s, background-color 0.2s;
    min-width: 60px; /* ▼▼▼ [수정] 최소 너비 보장 ▼▼▼ */
}

.history-tab:hover:not(.active) {
    color: var(--text-secondary, #aaa);
    background-color: rgba(255, 255, 255, 0.03);
}

.history-tab.active {
    color: var(--text-primary, #fff);
    background-color: var(--secondary-bg, #1e1e2e);
}

.history-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--buy-color, #22c55e), var(--accent-color, #6366f1));
}

/* 주문 목록 컨테이너 */
.order-list-container {
    padding: 12px;
    max-height: 280px;
    overflow-y: auto;
    background-color: var(--secondary-bg, #1e1e2e);
}

/* 개별 주문 아이템 스타일 */
.order-item,
.order-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background-color: var(--panel-color, #252535);
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: background-color 0.2s, transform 0.1s;
}

.order-item:hover,
.order-list-item:hover {
    background-color: var(--hover-bg, #2a2a3a);
    transform: translateX(2px);
}

.order-item:last-child,
.order-list-item:last-child {
    margin-bottom: 0;
}

/* 매수/매도 구분 */
.order-item.buy,
.order-list-item.buy {
    border-left-color: var(--buy-color, #22c55e);
}

.order-item.sell,
.order-list-item.sell {
    border-left-color: var(--sell-color, #ef4444);
}

/* 주문 정보 그룹 */
.order-info-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.order-info-group .type-price {
    font-weight: 600;
    font-size: 14px;
}

.order-info-group .type-buy { 
    color: var(--buy-color, #22c55e); 
}

.order-info-group .type-sell { 
    color: var(--sell-color, #ef4444); 
}

.order-info-group .qty-time {
    font-size: 12px;
    color: var(--text-muted, #888);
}

/* 주문 액션 (매수/매도 라벨) */
.order-action {
    font-weight: 600;
    font-size: 13px;
    padding: 2px 8px;
    border-radius: 4px;
}

.order-action.buy {
    color: var(--buy-color, #22c55e);
    background-color: rgba(34, 197, 94, 0.1);
}

.order-action.sell {
    color: var(--sell-color, #ef4444);
    background-color: rgba(239, 68, 68, 0.1);
}

/* 주문 타입 배지 */
.order-type-badge {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted, #888);
    padding: 2px 6px;
    background-color: var(--secondary-bg, #1e1e2e);
    border: 1px solid var(--border-color, #2d2d3d);
    border-radius: 4px;
}

/* 주문 상태 (체결 대기 등) */
.order-status {
    font-size: 11px;
    color: var(--warning-color, #f0ad4e);
    padding: 2px 6px;
    background-color: rgba(240, 173, 78, 0.1);
    border-radius: 4px;
}

/* 수량 및 가격 */
.order-qty {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary, #fff);
}

.order-price {
    font-size: 12px;
    color: var(--text-secondary, #aaa);
}

.order-time {
    font-size: 11px;
    color: var(--text-muted, #666);
}

/* 취소 버튼 개선 */
.order-actions .btn-cancel,
.btn-cancel {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 500;
    background-color: transparent;
    color: var(--text-muted, #888);
    border: 1px solid var(--border-color, #2d2d3d);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.order-actions .btn-cancel:hover,
.btn-cancel:hover {
    background-color: var(--sell-color, #ef4444);
    border-color: var(--sell-color, #ef4444);
    color: white;
}

/* 빈 메시지 스타일 */
.order-list-container .empty-message {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted, #666);
    font-size: 13px;
}

/* 거래내역 아이템 (체결된 거래) */
.trade-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background-color: var(--panel-color, #252535);
    border-radius: 8px;
    transition: background-color 0.2s;
}

.trade-history-item:hover {
    background-color: var(--hover-bg, #2a2a3a);
}

.trade-history-item .profit {
    font-weight: 600;
    font-size: 13px;
}

.trade-history-item .profit.positive {
    color: var(--buy-color, #22c55e);
}

.trade-history-item .profit.negative {
    color: var(--sell-color, #ef4444);
}

/* 주문 목록 스크롤바 */
.order-list-container::-webkit-scrollbar {
    width: 4px;
}

.order-list-container::-webkit-scrollbar-track {
    background: var(--secondary-bg, #1e1e2e);
    border-radius: 2px;
}

.order-list-container::-webkit-scrollbar-thumb {
    background: var(--border-color, #2d2d3d);
    border-radius: 2px;
}

.order-list-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted, #666);
}


/* ================================================== */
/* === 4. 호가창 패널도 스크롤 영역 내에 포함 === */
/* ================================================== */

.order-book-panel {
    flex-shrink: 0; /* 스크롤 시 줄어들지 않음 */
}


/* ================================================== */
/* === 5. 차트 영역 드롭다운 z-index 보장 === */
/* ================================================== */

.chart-header {
    position: relative;
    z-index: 100;
}

.chart-controls-left,
.timeframe-selector {
    position: relative;
    z-index: 101;
}

.timeframe-selector .dropdown {
    position: relative;
    z-index: 102;
}

.timeframe-selector .dropdown-menu {
    z-index: 9999 !important;
}
/* ============================================================================
   접이식 메뉴 및 모바일 팝업 스타일
   ============================================================================ */

/* === 접이식 섹션 공통 스타일 (기존 레이아웃 유지) === */
.collapsible-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    background-color: var(--secondary-bg);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.collapsible-section .section-header:hover {
    background-color: rgba(0,0,0,0.03);
}

.collapsible-section .section-header h2,
.collapsible-section .section-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.collapsible-section .collapse-icon {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    margin-left: auto;
}

.collapsible-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

/* 접힘 상태: section-content 숨김 */
.collapsible-section.collapsed .section-content {
    display: none;
}

/* 호가창 접혔을 때 ratio bar는 보이고 나머지 숨김 */
.order-book-panel.collapsed .ob-ratio-bar {
    display: flex !important;
}

.order-book-panel.collapsed .order-book-content {
    display: none !important;
}

.order-book-panel .section-header {
    display: flex;
    gap: 8px;
    align-items: center;
}

.order-book-panel .section-header .unit-text {
    color: var(--text-muted);
    font-size: 12px;
}

/* 주문 섹션 접힘 */
.order-section.collapsed .section-content {
    display: none;
}

/* 주문내역 섹션 접힘 */
.order-history-section.collapsed .section-content {
    display: none;
}

/* 내 주식 섹션 접힘 */
.owned-stock-details-section.collapsed .section-content {
    display: none;
}

/* === 모바일용 매수/매도 버튼 === */
.mobile-trade-buttons {
    display: none;
    gap: 12px;
    padding: 0;
    margin-bottom: 16px;
}

.mobile-trade-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-trade-btn.buy {
    background-color: var(--buy-color);
    color: white;
}

.mobile-trade-btn.sell {
    background-color: var(--sell-color);
    color: white;
}

.mobile-trade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* === 모바일 거래 팝업 모달 === */
.mobile-trade-modal .modal-content {
    width: 95%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
}

.trade-modal-content h2 {
    margin-bottom: 16px;
    font-size: 20px;
    text-align: center;
}

.modal-orderbook {
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.modal-ob-ratio-bar {
    display: flex;
    padding: 8px 12px;
    background-color: var(--secondary-bg);
    font-size: 12px;
}

.modal-ob-ratio-bar .ob-ratio-ask {
    flex: 1;
    text-align: left;
    color: var(--sell-color);
}

.modal-ob-ratio-bar .ob-ratio-bid {
    flex: 1;
    text-align: right;
    color: var(--buy-color);
}

.modal-orderbook-container {
    max-height: 200px;
    overflow-y: auto;
}

.modal-orderbook-container .order-book-asks,
.modal-orderbook-container .order-book-bids {
    max-height: 80px;
}

.modal-order-form {
    background-color: var(--secondary-bg);
    border-radius: 8px;
    padding: 16px;
}

.modal-order-form .trade-tabs {
    margin-bottom: 12px;
}

.modal-order-form .input-group {
    margin-bottom: 12px;
}

.modal-order-form .order-info {
    margin-bottom: 16px;
}

.modal-order-form .button-group button {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

/* === 데스크톱/모바일 표시 제어 === */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

/* === 미디어 쿼리: 모바일 (1024px 이하) === */
@media (max-width: 1024px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }
}

/* === 미디어 쿼리: 작은 모바일 (480px 이하) === */
@media (max-width: 480px) {
    .mobile-trade-modal .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-orderbook-container {
        max-height: 150px;
    }
}

/* ============================================================================
   [신규] 모바일 UI 개선
   ============================================================================ */

/* 모바일 차트 아래 퀵 버튼 */
.mobile-quick-buttons {
    display: none;
    gap: 8px;
    padding: 12px 16px;
    background: var(--primary-bg);
    border-bottom: 1px solid var(--border-color);
}

.mobile-quick-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-quick-btn:hover, .mobile-quick-btn:active {
    background: var(--hover-bg);
    border-color: var(--accent-color);
}

.mobile-quick-btn .quick-icon {
    font-size: 18px;
}

/* 모바일 하단 고정 버튼 */
.mobile-bottom-buttons {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    /* ▼▼▼ [수정] 투명 배경 + 블러 처리 ▼▼▼ */
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    gap: 12px;
    z-index: 100;
}

.mobile-bottom-btn {
    flex: 1;
    padding: 16px 20px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-bottom-btn.buy {
    background: var(--buy-color, #ef4444);
    color: white;
}

.mobile-bottom-btn.sell {
    background: var(--sell-color, #3b82f6);
    color: white;
}

/* ▼▼▼ [수정] 거래하기 버튼 - 살짝 투명한 검정 ▼▼▼ */
.mobile-bottom-btn.trade {
    background: rgba(26, 26, 26, 0.9);
    color: white;
}

.mobile-bottom-btn.orderbook {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.mobile-bottom-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* ============================================================================
   주문 모달 (모바일용)
   ============================================================================ */
.order-modal-content {
    max-width: 400px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
}

.order-modal-content h2 {
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 700;
}

.modal-trade-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.modal-trade-tab {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: var(--secondary-bg);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.modal-trade-tab.active {
    background: var(--buy-color);
    color: white;
}

.modal-trade-tab.active.sell-mode {
    background: var(--sell-color);
}

.modal-order-type {
    margin-bottom: 16px;
}

.modal-order-type select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-color);
    color: var(--text-primary);
}

.modal-input-group {
    margin-bottom: 16px;
}

.modal-input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.modal-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.modal-input-wrapper input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    font-size: 16px;
    background: transparent;
    color: var(--text-primary);
}

.modal-input-wrapper input:focus {
    outline: none;
}

.modal-input-unit {
    padding: 12px 16px;
    background: var(--secondary-bg);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.modal-qty-presets {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.modal-preset-btn {
    flex: 1;
    padding: 10px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-preset-btn:hover {
    background: var(--secondary-bg);
}

.modal-preset-btn:active {
    background: var(--border-color);
}

.modal-order-info {
    background: var(--secondary-bg);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.modal-info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.modal-info-row.total {
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    padding-top: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-submit-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-submit-btn.buy {
    background: var(--buy-color);
    color: white;
}

.modal-submit-btn.sell {
    background: var(--sell-color);
    color: white;
}

.modal-submit-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* ============================================================================
   바텀시트 모달
   ============================================================================ */
.bottom-sheet {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.bottom-sheet.active {
    display: block;
}

/* ▼▼▼ [수정] 배경 블러 처리 ▼▼▼ */
.bottom-sheet-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.bottom-sheet-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: var(--primary-bg);
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-sheet-container.small {
    max-height: 40vh;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--text-secondary);
    border-radius: 2px;
    margin: 12px auto 8px;
    opacity: 0.5;
}

.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px 16px;
    border-bottom: 1px solid var(--border-color);
}

.bottom-sheet-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.sheet-stock-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sheet-stock-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.sheet-stock-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.sheet-stock-change {
    font-size: 14px;
    font-weight: 500;
}

.sheet-stock-change.positive { color: var(--positive); }
.sheet-stock-change.negative { color: var(--negative); }

.bottom-sheet-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--secondary-bg);
    border-radius: 50%;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.bottom-sheet-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.bottom-sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* ============================================================================
   시트 탭 (가시성 개선)
   ============================================================================ */
.sheet-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    background: var(--secondary-bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sheet-tab {
    flex: 1;
    padding: 16px 12px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.sheet-tab:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
}

.sheet-tab.active {
    color: var(--accent-color, #6366f1);
    background: var(--primary-bg);
}

.sheet-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-color, #6366f1);
}

.sheet-tab-content {
    display: none;
    padding: 16px;
}

.sheet-tab-content.active {
    display: block;
}

/* ============================================================================
   주문 탭 - PC 버전과 동일한 구조
   ============================================================================ */
.sheet-trade-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    background: var(--secondary-bg);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.sheet-trade-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.sheet-trade-tab.buy.active {
    background: var(--buy-color, #ef4444);
    color: white;
}

.sheet-trade-tab.sell.active {
    background: var(--sell-color, #3b82f6);
    color: white;
}

.sheet-order-type {
    margin-bottom: 16px;
}

.sheet-order-type-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--secondary-bg);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.sheet-input-group {
    margin-bottom: 16px;
}

.sheet-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.sheet-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.sheet-input {
    flex: 1;
    padding: 14px 16px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
}

.sheet-input::placeholder {
    color: var(--text-secondary);
}

.sheet-input-unit {
    padding: 14px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    background: var(--hover-bg);
    border-left: 1px solid var(--border-color);
}

.sheet-qty-presets {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.sheet-preset-btn {
    flex: 1;
    padding: 10px 8px;
    border: 1px solid var(--border-color);
    background: var(--secondary-bg);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.sheet-preset-btn:hover, .sheet-preset-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* 주문 정보 */
.sheet-order-info {
    padding: 16px;
    background: var(--secondary-bg);
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.sheet-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 8px 0;
    color: var(--text-secondary);
}

.sheet-info-row span:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

.sheet-info-row.total {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 15px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.sheet-info-row.total span:last-child {
    font-size: 16px;
}

.sheet-submit-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.sheet-submit-btn.buy {
    background: var(--buy-color, #ef4444);
    color: white;
}

.sheet-submit-btn.sell {
    background: var(--sell-color, #3b82f6);
    color: white;
}

.sheet-submit-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.sheet-submit-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
}

/* ============================================================================
   호가 탭
   ============================================================================ */
.sheet-orderbook-wrapper {
    background: var(--secondary-bg);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.sheet-ob-ratio-bar {
    display: flex;
    padding: 12px 16px;
    background: var(--primary-bg);
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
}

.sheet-ob-ratio-ask {
    flex: 1;
    color: var(--sell-color);
}

.sheet-ob-ratio-bid {
    flex: 1;
    text-align: right;
    color: var(--buy-color);
}

.sheet-orderbook-container {
    max-height: 350px;
    overflow-y: auto;
}

.sheet-ob-asks, .sheet-ob-bids {
    display: flex;
    flex-direction: column;
}

.sheet-ob-asks {
    flex-direction: column-reverse;
}

.sheet-ob-row, .ob-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 14px;
    position: relative;
    cursor: pointer;
    transition: background 0.15s;
}

.sheet-ob-row:hover, .ob-row:hover {
    background: var(--hover-bg);
}

.sheet-ob-row .ob-price, .ob-row .ob-price {
    flex: 1;
    font-weight: 500;
}

.sheet-ob-row .ob-quantity, .ob-row .ob-quantity {
    width: 80px;
    text-align: right;
    color: var(--text-secondary);
}

.sheet-ob-row .ob-bar, .ob-row .ob-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    opacity: 0.15;
}

.sheet-ob-row.ask .ob-price { color: var(--sell-color); }
.sheet-ob-row.ask .ob-bar { background: var(--sell-color); }
.sheet-ob-row.bid .ob-price { color: var(--buy-color); }
.sheet-ob-row.bid .ob-bar { background: var(--buy-color); }

.sheet-ob-current {
    padding: 14px 16px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    background: var(--primary-bg);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* ============================================================================
   미체결 탭
   ============================================================================ */
.sheet-pending-list {
    max-height: 400px;
    overflow-y: auto;
}

.sheet-pending-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: var(--secondary-bg);
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 3px solid;
    border: 1px solid var(--border-color);
}

.sheet-pending-item.buy {
    border-left: 3px solid var(--buy-color);
}

.sheet-pending-item.sell {
    border-left: 3px solid var(--sell-color);
}

.sheet-pending-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.sheet-pending-row span:first-child {
    color: var(--text-secondary);
}

.sheet-pending-cancel {
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    border: 1px solid var(--negative);
    background: transparent;
    border-radius: 6px;
    color: var(--negative);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sheet-pending-cancel:hover {
    background: var(--negative);
    color: white;
}

/* ============================================================================
   내 주식 시트
   ============================================================================ */
.sheet-mystock-info {
    padding: 8px 0;
}

.mystock-value-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.mystock-value {
    font-size: 24px;
    font-weight: 700;
}

.mystock-change {
    font-size: 14px;
    font-weight: 500;
}

.mystock-change.positive { color: var(--positive); }
.mystock-change.negative { color: var(--negative); }

.mystock-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

.mystock-detail-row:last-child {
    border-bottom: none;
}

.mystock-detail-row span:first-child {
    color: var(--text-secondary);
}

.mystock-detail-row span:last-child {
    font-weight: 500;
}

/* 호가창 기본 스크롤 개선 - 매수/매도 통합 스크롤 */
.order-book-content {
    max-height: none;
    overflow: visible;
}

.order-book-container {
    max-height: 400px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* ▼▼▼ [수정] 매도/매수 각각 스크롤 제거 → 통합 스크롤 ▼▼▼ */
.order-book-asks, .order-book-bids {
    max-height: none;
    overflow-y: visible;
    flex: none;
}

/* 미체결 메뉴 최소 높이 설정 */
.order-history-section .order-list-container {
    min-height: 120px;
    max-height: 250px;
}

/* ============================================================================
   모바일 미디어 쿼리 (1024px 이하)
   ============================================================================ */
@media (max-width: 1024px) {
    /* 모바일에서 하단 버튼 표시 */
    .mobile-bottom-buttons {
        display: flex !important;
    }

    /* ▼▼▼ [핵심] 페이지 자체가 스크롤 컨테이너 ▼▼▼ */
    #page-stock-detail {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: 100% !important;
    }

    /* ▼▼▼ [핵심] 상세페이지 컨테이너 - 높이 제한 완전 해제 ▼▼▼ */
    #page-stock-detail .detail-container {
        flex-direction: column !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        padding-bottom: 100px;
        overflow: visible !important;
    }

    /* 메인 컨텐츠 - 모든 높이/스크롤 제한 해제 */
    #page-stock-detail .main-content {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* 차트 영역 - 모든 높이/스크롤 제한 해제 */
    #page-stock-detail .chart-area {
        flex: none !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* ▼▼▼ [핵심] 우측 사이드바 - 모든 높이/스크롤 제한 해제 ▼▼▼ */
    #page-stock-detail .right-sidebar {
        display: block !important;
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        flex: none !important;
        margin-top: 16px;
        padding: 0 16px;
    }

    /* 사이드바 내부 섹션 스타일 조정 */
    #page-stock-detail .right-sidebar .collapsible-section {
        margin-bottom: 16px;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* 내 주식 섹션 */
    #page-stock-detail .owned-stock-details-section {
        background: var(--panel-color);
        border-radius: var(--border-radius);
        border: 1px solid var(--border-color);
        padding: 16px;
    }

    /* 주문 섹션 숨김 (모달로 대체) */
    #page-stock-detail .order-section {
        display: none !important;
    }

    /* 주문내역 섹션 */
    #page-stock-detail .order-history-section {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    #page-stock-detail .order-history-section .section-content {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    #page-stock-detail .order-list-container {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* 호가창 모바일 스타일 */
    #page-stock-detail .order-book-panel {
        background: var(--panel-color);
        border-radius: var(--border-radius);
        border: 1px solid var(--border-color);
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    #page-stock-detail .order-book-container {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* 차트 영역 높이 고정 */
    #page-stock-detail #chart-container {
        height: 280px !important;
        min-height: 280px;
    }

    /* 종목 정보 버튼 영역 */
    #page-stock-detail .chart-controls-left {
        flex-wrap: wrap;
        gap: 8px;
    }

    #page-stock-detail .stock-supply-info.desktop-only {
        display: none;
    }
}

/* 작은 화면 (480px 이하) */
@media (max-width: 480px) {
    #page-stock-detail .stock-header {
        padding: 12px 16px;
    }

    #page-stock-detail .stock-info-main {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    #page-stock-detail .stock-icon-large {
        width: 48px;
        height: 48px;
    }

    #page-stock-detail .current-price-large {
        font-size: 24px;
    }

    #page-stock-detail .change-large {
        font-size: 14px;
    }

    #page-stock-detail #chart-container {
        height: 240px !important;
    }

    /* 내 주식 카드 컴팩트 */
    .owned-stock-details-section .info-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .owned-stock-details-section .value {
        font-size: 22px;
    }
}

/* ============================================================================
   내 주식 카드 버튼 (모바일용)
   ============================================================================ */
.mystock-action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.mystock-action-btn {
    flex: 1;
    padding: 14px 16px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.mystock-action-btn.trade {
    background: var(--buy-color, #ef4444);
    color: white;
}

.mystock-action-btn.orderbook {
    background: var(--secondary-bg, #f7f7f8);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.mystock-action-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* mobile-only: PC에서 숨김 */
.mobile-only {
    display: none;
}

@media (max-width: 1024px) {
    .mobile-only {
        display: flex;
    }

    .desktop-only {
        display: none !important;
    }
}
/* ========================================================================== */
/* [신규] 모바일 주문 팝업 버튼 하단 고정 (스크롤 없이 즉시 클릭 가능) */
/* ========================================================================== */

/* 1. 모달 전체 컨테이너: 화면 높이에 맞추고 스크롤 방지 */
#mobile-order-modal .modal-content {
    display: flex;
    flex-direction: column;
    max-height: 85vh; /* 화면의 85%만 차지 */
    overflow: hidden; /* 모달 전체 스크롤 제거 */
    padding-bottom: 0; /* 하단 패딩 제거 (버튼 공간 확보) */
    position: relative;
}

/* 2. 내용 영역 (입력창들): 남은 공간을 차지하며 스크롤 가능하게 설정 */
#mobile-order-modal .modal-body {
    flex: 1; /* 남은 공간 모두 차지 */
    overflow-y: auto; /* 내용이 넘치면 스크롤 */
    padding-bottom: 80px; /* 하단 버튼에 가려지지 않도록 여백 추가 */
    padding-right: 4px; /* 스크롤바 공간 */
}

/* 3. 매수/매도 버튼: 하단에 절대 위치로 고정 */
#modal-submit-btn {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    margin: 0;
    border-radius: 0; /* 하단 모서리 딱 맞게 */
    padding: 18px; /* 터치 영역 넉넉하게 */
    z-index: 100;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1); /* 버튼 위에 그림자 추가 */
}

/* (옵션) 만약 버튼이 둥근 모서리 디자인이라면 아래 코드 사용 */
/* #modal-submit-btn {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: calc(100% - 40px);
    border-radius: 12px;
}
*/

/* ================================================== */
/* === [v3.2] PC 퍼센트 버튼 스타일 === */
/* ================================================== */
.pc-preset-btns {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    margin-bottom: 12px;
}

.pc-preset-btn {
    flex: 1;
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #aaa);
    background-color: var(--panel-color, #252535);
    border: 1px solid var(--border-color, #2d2d3d);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pc-preset-btn:hover {
    background-color: var(--hover-bg, #2a2a3a);
    color: var(--text-primary, #fff);
    border-color: var(--accent-color, #6366f1);
}

.pc-preset-btn:active {
    transform: scale(0.95);
}

/* ================================================== */
/* === [v3.2] 알림 스택 시스템 === */
/* ================================================== */
.notification {
    position: fixed !important; 
    right: 24px; 
    padding: 14px 40px 14px 18px;  /* X 버튼 공간 확보 */
    border-radius: 8px; 
    color: white !important; 
    font-size: 14px; 
    font-weight: 500;
    z-index: 99999 !important; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transform: translateX(0); 
    opacity: 1;
    transition: transform 0.3s ease, opacity 0.3s ease, top 0.3s ease;
    pointer-events: auto;  /* 클릭 가능하게 변경 */
    max-width: 320px; 
    word-wrap: break-word;
    /* top은 JS에서 동적으로 설정 */
}

.notification .notification-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 18px;
    text-align: center;
    transition: background 0.2s;
}

.notification .notification-close:hover {
    background: rgba(255,255,255,0.4);
}

.notification.hiding {
    transform: translateX(120%);
    opacity: 0;
}

/* ================================================== */
/* === [v3.2] history-tabs 반응형 수정 === */
/* ================================================== */
.order-history-section .history-tabs {
    display: flex;
    flex-wrap: nowrap;  /* 줄바꿈 방지 */
    min-height: 40px;
}

.order-history-section .history-tab {
    flex: 1 1 auto;
    min-width: 50px;  /* ▼▼▼ [수정] 최소 너비 확보 ▼▼▼ */
    padding: 10px 8px;
    font-size: 12px;
    white-space: nowrap;
    overflow: visible; /* ▼▼▼ [수정] hidden → visible ▼▼▼ */
}

/* 좁은 화면에서도 탭이 제대로 보이도록 */
@media (max-width: 1200px) {
    .order-history-section .history-tab {
        padding: 8px 6px; /* ▼▼▼ [수정] 패딩 약간 증가 ▼▼▼ */
        font-size: 11px;
    }
}

@media (max-width: 900px) {
    .order-history-section {
        min-width: 0;
    }

    .order-history-section .history-tabs {
        flex-direction: row;
    }

    .order-history-section .history-tab {
        padding: 10px 4px; /* ▼▼▼ [수정] 세로 패딩 유지 ▼▼▼ */
        font-size: 11px;
    }
}

/* ================================================== */
/* === [v3.2] 거래내역 병합 스타일 === */
/* ================================================== */
.trade-group {
    margin-bottom: 12px;
    background-color: var(--panel-color, #252535);
    border-radius: 8px;
    overflow: hidden;
}

.trade-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background-color: var(--secondary-bg, #1e1e2e);
    cursor: pointer;
    transition: background 0.2s;
}

.trade-group-header:hover {
    background-color: var(--hover-bg, #2a2a3a);
}

.trade-group-time {
    font-size: 12px;
    color: var(--text-muted, #888);
}

.trade-group-summary {
    display: flex;
    gap: 12px;
    font-size: 12px;
}

.trade-group-summary .buy-count {
    color: var(--buy-color, #22c55e);
}

.trade-group-summary .sell-count {
    color: var(--sell-color, #ef4444);
}

.trade-group-items {
    display: none;
    padding: 8px 12px;
    border-top: 1px solid var(--border-color, #2d2d3d);
}

.trade-group.expanded .trade-group-items {
    display: block;
}

.trade-group-toggle {
    font-size: 10px;
    color: var(--text-muted, #888);
    transition: transform 0.2s;
}

.trade-group.expanded .trade-group-toggle {
    transform: rotate(180deg);
}

.trade-mini-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 11px;
    color: var(--text-secondary, #aaa);
    border-bottom: 1px solid var(--border-color, #2d2d3d);
}

.trade-mini-item:last-child {
    border-bottom: none;
}

.trade-mini-item.buy {
    border-left: 2px solid var(--buy-color, #22c55e);
    padding-left: 8px;
}

.trade-mini-item.sell {
    border-left: 2px solid var(--sell-color, #ef4444);
    padding-left: 8px;
}
/* =========================================================================
   [v3.5] 취소된 주문 스타일
   ========================================================================= */

/* 취소 타입 텍스트 색상 */
.type-cancelled {
    color: #888 !important;
}

/* 취소된 거래 아이템 */
.order-list-item.cancelled {
    opacity: 0.7;
    background: rgba(128, 128, 128, 0.05);
}

/* 취소된 미니 아이템 */
.trade-mini-item.cancelled {
    opacity: 0.6;
    background: rgba(128, 128, 128, 0.05);
}

.trade-mini-item.cancelled span {
    color: #888;
}

/* 취소 카운트 표시 */
.cancelled-count {
    color: #888;
    font-size: 12px;
    margin-right: 8px;
}

/* ================================================== */
/* === [신규] 종목 뉴스 버튼 및 배지 스타일 === */
/* ================================================== */

/* 뉴스 버튼 (종목정보 버튼과 동일한 스타일 + 배지 공간) */
.btn-stock-news {
    position: relative;
    padding-right: 16px; /* 배지 공간 확보 */
}

/* 뉴스 배지 (빨간 동그라미) */
.news-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background-color: #e64b4b;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* 인기주식 페이지 - 아이콘 위 뉴스 빨간 점 */
.stock-row .icon-wrapper {
    position: relative;
    display: inline-block;
}

.stock-row .stock-news-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background-color: #e64b4b;
    border-radius: 50%;
    border: 2px solid white;
}

/* 종목명 컨테이너 (배지 표시용) */
.stock-name-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* ================================================== */
/* === [신규] 종목 뉴스 모달 스타일 === */
/* ================================================== */

.stock-news-modal-content {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.stock-news-modal-content h2 {
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 600;
}

/* 종목 뉴스 목록 */
.stock-news-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 개별 뉴스 아이템 */
.stock-news-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    background-color: var(--secondary-bg);
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.stock-news-item:hover {
    background-color: #e9ecef;
    transform: translateY(-1px);
}

.stock-news-item:active {
    transform: translateY(0);
}

.stock-news-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stock-news-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.stock-news-item-press {
    font-weight: 500;
}

.stock-news-item-time {
    color: var(--text-muted);
}

/* 지수 뉴스 표시 (TSDQ/OTBX) */
.stock-news-item.index-news {
    border-left: 3px solid #6366f1;
}

.stock-news-item .index-label {
    font-size: 10px;
    padding: 2px 6px;
    background-color: #6366f1;
    color: white;
    border-radius: 4px;
    font-weight: 500;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .stock-news-modal-content {
        max-width: 95%;
        margin: 16px;
    }

    .stock-news-item {
        padding: 12px;
    }

    .stock-news-item-title {
        font-size: 13px;
    }
}

/* ================================================== */
/* === [신규] 뉴스 모달 푸터 및 댓글보기 버튼 === */
/* ================================================== */

.news-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.btn-news-comment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background-color: #5865F2; /* 디스코드 색상 */
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.1s;
    margin-left: auto;
}

.btn-news-comment:hover {
    background-color: #4752C4;
    transform: translateY(-1px);
}

.btn-news-comment:active {
    transform: translateY(0);
}

/* ================================================== */
/* === [신규] 상단 네비게이션 뉴스 알림 점 === */
/* ================================================== */

.nav-links a {
    position: relative;
}

.nav-news-dot {
    position: absolute;
    top: -2px;
    right: -8px;
    width: 8px;
    height: 8px;
    background-color: #e64b4b;
    border-radius: 50%;
}

/* ================================================== */
/* === [신규] 뉴스 페이지 헤더 및 전체뉴스 버튼 === */
/* ================================================== */

.news-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.news-page-header h1 {
    margin: 0;
}

.btn-all-news {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 18px;
    background-color: #5865F2;
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-all-news:hover {
    background-color: #4752C4;
    transform: translateY(-1px);
}

.btn-all-news:active {
    transform: translateY(0);
}

/* ================================================== */
/* === [신규] 인기주식 더 보기 버튼 === */
/* ================================================== */

.market-show-more-btn {
    padding: 16px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.market-show-more-btn button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 300px;
    padding: 12px 24px;
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.market-show-more-btn button:hover {
    background-color: #e9ecef;
    color: var(--text-primary);
}

.market-show-more-btn button:active {
    transform: scale(0.98);
}

.market-show-more-btn .arrow-down,
.market-show-more-btn .arrow-up {
    font-size: 10px;
}

/* ================================================== */
/* === [신규] 인기주식 지수 카드 v2 (스파크라인 포함) === */
/* ================================================== */

.market-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.market-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.market-title-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.market-title-left h1 {
    margin: 0;
}

.market-status-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.market-indices {
    display: flex;
    align-items: center;
    gap: 16px;
}

.index-card-v2 {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 200px;
}

.index-card-v2:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-color: #ddd;
}

.index-chart-container {
    flex-shrink: 0;
}

.index-chart-container canvas {
    display: block;
}

.index-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.index-card-v2 .index-title {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.index-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.index-card-v2 .index-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.index-card-v2 .index-change {
    font-size: 13px;
    font-weight: 500;
}

/* 한국 색상: 상승=빨강, 하락=파랑 */
.index-card-v2 .index-change.positive {
    color: #ff5252;
}

.index-card-v2 .index-change.negative {
    color: #2196f3;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .market-title-row {
        flex-wrap: wrap;
    }

    .market-indices {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        width: 100%;
    }

    .index-card-v2 {
        min-width: auto;
        width: 100%;
    }
}