:root {
    --bg-primary: #050505; --bg-secondary: #0a0a0a; --bg-panel: #111; --bg-header: #0d0d0d;
    --bg-input: #1a1a1a; --border: #222; --text-primary: #e5e5e5; --text-secondary: #999;
    --text-muted: #555; --accent: #3b82f6; --price-up: #ef4444; --price-down: #3b82f6;
    --price-flat: #999; --btn-buy: #ef4444; --btn-sell: #3b82f6;
}
body[data-theme="light"] {
    --bg-primary: #f5f5f5; --bg-secondary: #fff; --bg-panel: #fff; --bg-header: #fff;
    --bg-input: #f0f0f0; --border: #e0e0e0; --text-primary: #111; --text-secondary: #666; --text-muted: #999;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg-primary); color: var(--text-primary); font-family: -apple-system, 'Segoe UI', sans-serif; font-size: 13px; overflow: hidden; }

/* Header */
.wts-header { display: flex; align-items: center; height: 40px; padding: 0 12px; background: var(--bg-header); border-bottom: 1px solid var(--border); position: relative; z-index: 100; }
.wts-logo { font-size: 15px; font-weight: 700; color: var(--accent); cursor: pointer; margin-right: 16px; white-space: nowrap; }
.wts-nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.wts-nav::-webkit-scrollbar { display: none; }
.wts-nav-item { padding: 6px 10px; color: var(--text-secondary); cursor: pointer; white-space: nowrap; font-size: 13px; border-radius: 4px; }
.wts-nav-item:hover { color: var(--text-primary); }
.wts-nav-item.active { color: var(--accent); font-weight: 600; }
.wts-header-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.wts-balance-display { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.wts-balance-display .amount { color: #fbbf24; font-weight: 600; }
.wts-theme-toggle,.wts-logout-btn,.wts-hamburger { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 13px; padding: 4px 6px; }

/* Stock Page Layout */
.stock-page { height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden; }

.symbol-bar { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); min-height: 36px; flex-wrap: wrap; }
.sym-name { font-size: 16px; font-weight: 700; }
.sym-code { font-size: 11px; color: var(--text-muted); }
.sym-price { font-size: 18px; font-weight: 700; }
.sym-change { font-size: 12px; }
.sym-extra { font-size: 11px; color: var(--text-muted); margin-left: auto; }

/* 3-column body */
.stock-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }

/* Chart column */
.stock-chart-col { flex: 1; display: flex; flex-direction: column; border-right: 1px solid var(--border); min-width: 0; }
.chart-toolbar { display: flex; gap: 2px; padding: 4px 6px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); }
.chart-tf { padding: 3px 8px; background: none; border: 1px solid var(--border); border-radius: 3px; color: var(--text-secondary); cursor: pointer; font-size: 11px; }
.chart-tf:hover { border-color: var(--accent); color: var(--accent); }
.chart-tf.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chart-sep { color: var(--border); margin: 0 2px; font-size: 11px; }
.chart-shape-btn { padding: 3px 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 3px; color: var(--text-secondary); cursor: pointer; font-size: 11px; font-family: inherit; }
.chart-shape-btn:hover { border-color: var(--accent); color: var(--accent); }

/* 차트모양 모달 */
.csm-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.csm-modal { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; min-width: 340px; max-width: 420px; box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.csm-title { font-size: 16px; font-weight: 700; text-align: center; margin-bottom: 16px; color: var(--text-primary); }
.csm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.csm-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; background: var(--bg-input); border: 2px solid transparent; border-radius: 10px; cursor: pointer; transition: all 0.15s; }
.csm-item:hover { border-color: var(--accent); background: var(--bg-hover, rgba(255,255,255,0.05)); }
.csm-item.active { border-color: var(--accent); background: rgba(59,130,246,0.1); }
.csm-icon { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.csm-name { font-size: 10px; color: var(--text-secondary); white-space: nowrap; text-align: center; }
.ma-legend { font-size: 10px; color: var(--text-muted); margin-left: auto; display: flex; gap: 6px; align-items: center; white-space: nowrap; }
#chart-container { flex: 1; min-height: 350px; }

/* Orderbook column */
.stock-ob-col { width: 280px; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--bg-secondary); }
.ob-header { display: flex; padding: 6px 0; font-size: 11px; color: var(--text-muted); text-align: center; border-bottom: 1px solid var(--border); }
.ob-header span { flex: 1; }
.ob-scroll { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.ob-row { display: flex; align-items: center; cursor: pointer; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.02); }
.ob-row:hover { background: rgba(255,255,255,0.03); }
.ob-qty { flex: 1; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; padding: 0 4px; }
.ask-qty { color: var(--price-down); }
.bid-qty { color: var(--price-up); }
.ob-price-cell { flex: 1.2; text-align: center; font-size: 12px; padding: 3px 2px; line-height: 1.3; }
.ob-price-cell b { font-size: 12px; }
.ob-price-cell small { font-size: 9px; color: var(--text-muted); }
.ob-ask { background: rgba(59,130,246,0.03); }
.ob-bid { background: rgba(239,68,68,0.03); }
.ob-current {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 0;
    background: var(--bg-input);
    border-top: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
}
.ob-cur-price { font-size: 16px; font-weight: 700; }
.ob-cur-change { font-size: 12px; }
.ob-footer { display: flex; justify-content: space-between; padding: 6px 8px; font-size: 11px; color: var(--text-muted); border-top: 1px solid var(--border); }

/* Right column */
.stock-right-col { width: 260px; display: flex; flex-direction: column; background: var(--bg-secondary); overflow: hidden; }
.order-form { padding: 10px; border-bottom: 1px solid var(--border); }
.order-type-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.order-type-tab { flex: 1; padding: 6px; text-align: center; background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; color: var(--text-secondary); cursor: pointer; font-size: 12px; }
.order-type-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.order-field { margin-bottom: 6px; }
.order-field label { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.order-field input { width: 100%; padding: 7px 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; color: var(--text-primary); font-size: 13px; outline: none; text-align: right; }
.order-field input:focus { border-color: var(--accent); }
.qty-row { display: flex; gap: 4px; }
.qty-row input { flex: 1; }
.qty-btns { display: flex; gap: 2px; }
.qty-btn { padding: 4px 6px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 3px; color: var(--text-secondary); cursor: pointer; font-size: 10px; white-space: nowrap; }
.qty-btn:hover { border-color: var(--accent); }
.qty-shortcuts { display: flex; gap: 3px; margin-bottom: 8px; }
.qty-shortcut { flex: 1; padding: 4px; text-align: center; background: var(--bg-input); border: 1px solid var(--border); border-radius: 3px; color: var(--text-secondary); cursor: pointer; font-size: 10px; }
.qty-shortcut:hover { border-color: var(--accent); color: var(--accent); }
.order-buttons { display: flex; gap: 6px; margin-bottom: 6px; }
.order-btn { flex: 1; padding: 10px; border: none; border-radius: 4px; font-size: 14px; font-weight: 700; cursor: pointer; }
.order-btn:hover { opacity: 0.85; }
.order-btn.buy { background: var(--btn-buy); color: #fff; }
.order-btn.sell { background: var(--btn-sell); color: #fff; }
.order-summary { font-size: 11px; color: var(--text-secondary); }
.order-summary .row { display: flex; justify-content: space-between; padding: 2px 0; }
.order-summary .val { color: var(--text-primary); }

/* Stock list */
.stock-list-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; border-top: 1px solid var(--border); }
.stock-list-tabs { display: flex; border-bottom: 1px solid var(--border); }
.sl-tab { flex: 1; padding: 6px 0; text-align: center; font-size: 12px; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.15s; }
.sl-tab:hover { color: var(--text-primary); }
.sl-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.stock-list-header { padding: 6px; }
.stock-list-header input { width: 100%; padding: 6px 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; color: var(--text-primary); font-size: 12px; outline: none; }
.stock-list-scroll { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.sl-item { display: flex; align-items: center; padding: 5px 8px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.02); gap: 4px; }
.sl-item:hover { background: rgba(255,255,255,0.03); }
.sl-item.active { background: rgba(59,130,246,0.08); }
.sl-fav { font-size: 13px; color: var(--text-muted); cursor: pointer; width: 18px; text-align: center; flex-shrink: 0; transition: color 0.15s; }
.sl-fav:hover { color: #fbbf24; }
.sl-fav.fav-on { color: #fbbf24; }
.sl-name { flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-price { font-size: 12px; font-weight: 600; text-align: right; min-width: 55px; }
.sl-chg { font-size: 10px; text-align: right; min-width: 48px; }

/* Bottom Panel */
.bottom-panel { border-top: 1px solid var(--border); background: var(--bg-secondary); max-height: 180px; overflow: hidden; }
.bp-tabs { display: flex; border-bottom: 1px solid var(--border); }
.bp-tab { padding: 7px 14px; font-size: 12px; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; }
.bp-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.bp-content { overflow-y: auto; max-height: 140px; }
.bp-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.bp-table th { position: sticky; top: 0; background: var(--bg-header); padding: 5px 8px; text-align: center; color: var(--text-muted); font-weight: 500; }
.bp-table td { padding: 5px 8px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.02); }
.bp-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 12px; }
.cancel-btn { background: none; border: 1px solid #555; color: #999; padding: 2px 8px; border-radius: 3px; cursor: pointer; font-size: 10px; }

/* Colors */
.price-up { color: var(--price-up) !important; }
.price-down { color: var(--price-down) !important; }
.price-flat { color: var(--price-flat) !important; }

/* Toast */
.toast-container { position: fixed; top: 50px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 6px; }
.toast { padding: 10px 16px; border-radius: 6px; font-size: 12px; color: #fff; animation: toastIn 0.3s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.info { background: #3b82f6; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* Mobile overrides */
@media (max-width: 768px) {
    .wts-bottom-tabs { display: flex !important; }
    .wts-mobile-balance { display: flex !important; }
    .wts-nav { display: none; }
    .wts-balance-display { display: none; }
    .wts-logout-btn { font-size: 11px; padding: 4px 8px; }
}

/* Bottom Sheet (wts.css handles .active class styling) */

@media (max-width: 1024px) {
    .stock-ob-col { width: 220px; }
    .stock-right-col { width: 200px; }
}

/* ===== Mobile Layout ===== */
@media (max-width: 768px) {
    body { overflow: hidden; }

    /* 전체 높이: 탭바(64px) + 잔고바(36px) + safe-area 제외 */
    .stock-page {
        height: auto;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(64px + 36px + env(safe-area-inset-bottom, 0px));
    }

    /* 3컬럼 → 세로 스택 */
    .stock-body {
        flex-direction: column;
        overflow: visible;
    }

    /* 심볼바: 컴팩트 */
    .symbol-bar {
        padding: 8px 12px;
        gap: 6px;
    }
    .sym-name { font-size: 15px; }
    .sym-price { font-size: 16px; }
    .sym-change { font-size: 11px; }
    .sym-extra { font-size: 10px; width: 100%; margin-left: 0; margin-top: 2px; }

    /* 차트: 고정 높이 */
    .stock-chart-col {
        min-height: 0;
        height: 360px;
        flex: none;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    #chart-container { height: 320px; min-height: 0; }
    .chart-toolbar {
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .chart-toolbar::-webkit-scrollbar { display: none; }
    .chart-tf { flex-shrink: 0; padding: 5px 10px; font-size: 12px; }

    /* 호가: 5단 컴팩트, 스크롤 없음 */
    .stock-ob-col {
        width: 100%;
        max-height: none;
        overflow: hidden;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .ob-scroll {
        overflow: hidden !important;
        flex: none;
    }
    .ob-header { padding: 4px 0; font-size: 10px; }
    .ob-row { padding: 4px 0; }
    .ob-price-cell { font-size: 12px; padding: 2px 2px; line-height: 1.2; }
    .ob-price-cell b { font-size: 13px; }
    .ob-price-cell small { font-size: 9px; }
    .ob-qty { font-size: 11px; }
    .ob-footer { padding: 4px 8px; font-size: 10px; }

    /* 주문폼: 풀폭 */
    .stock-right-col {
        width: 100%;
        overflow: visible;
    }
    .order-form { padding: 12px; }
    .order-buttons { gap: 8px; }
    .order-btn { padding: 12px; font-size: 15px; border-radius: 8px; }
    .qty-shortcuts { gap: 4px; }
    .qty-shortcut { padding: 6px; font-size: 11px; border-radius: 6px; }

    /* 종목 리스트 패널 */
    .stock-list-panel { max-height: 250px; }
    .sl-item { padding: 8px 10px; }
    .sl-name { font-size: 13px; }
    .sl-price { font-size: 13px; }

    /* 하단 패널: 보유/미체결/체결 */
    .bottom-panel {
        max-height: none;
        border-top: 1px solid var(--border);
    }
    .bp-content { max-height: 200px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .bp-tab { padding: 10px 12px; font-size: 13px; }
    .bp-table td, .bp-table th { padding: 6px 6px; font-size: 11px; white-space: nowrap; }

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

/* ===== Small Mobile ===== */
@media (max-width: 480px) {
    .stock-chart-col { height: 260px; }
    #chart-container { height: 220px; }
    .sym-name { font-size: 14px; }
    .sym-price { font-size: 15px; }
    .order-form { padding: 10px; }
    .order-field input { font-size: 14px; padding: 8px; }
    .qty-btn { padding: 5px 8px; font-size: 11px; }
}

/* ===== Index Ticker Bar ===== */
.index-ticker {
    display: flex;
    align-items: center;
    gap: 0;
    height: 28px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}
.index-ticker::-webkit-scrollbar { display: none; }
.index-ticker:empty { display: none; }
.idx-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    white-space: nowrap;
    border-right: 1px solid var(--border);
    font-size: 11px;
}
.idx-item:last-child { border-right: none; }
.idx-name { color: var(--text-muted); font-size: 10px; }
.idx-price { font-weight: 600; }
.idx-chg { font-size: 10px; }

@media (max-width: 768px) {
    .index-ticker { height: 26px; }
    .idx-item { padding: 0 10px; gap: 4px; font-size: 10px; }
    .idx-name { font-size: 9px; }
    .idx-chg { font-size: 9px; }
}

/* ===== Market Page (시세) ===== */
.market-page {
    padding: 16px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.market-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    flex-shrink: 0;
}
.market-header h2 { font-size: 18px; white-space: nowrap; }
.market-header input {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    width: 100%;
    max-width: 300px;
    font-size: 14px;
    outline: none;
}
.market-header input:focus { border-color: var(--accent); }
.market-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}
.market-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.market-table thead { position: sticky; top: 0; z-index: 1; background: var(--bg-secondary); }
.market-table th {
    padding: 8px 6px;
    text-align: right;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.market-table th:first-child { text-align: left; }
.market-table tr[data-symbol] { cursor: pointer; }
.market-table tr[data-symbol]:hover { background: var(--bg-hover, rgba(255,255,255,0.03)); }
.market-table tr[data-symbol]:active { background: var(--bg-hover, rgba(255,255,255,0.06)); }
.market-table td {
    padding: 7px 6px;
    text-align: right;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.market-td-name {
    text-align: left !important;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.m-name { font-size: 12px; font-weight: 500; }
.m-code { font-size: 10px; color: var(--text-muted); }
.market-td-price { font-weight: 600; font-size: 13px; }
.market-td-chg { font-size: 12px; }
.market-td-vol { font-size: 11px; color: var(--text-secondary); }

@media (max-width: 768px) {
    .market-page {
        padding: 10px;
        padding-bottom: calc(64px + 36px + env(safe-area-inset-bottom, 0px));
    }
    .market-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .market-header h2 { font-size: 16px; }
    .market-header input { max-width: none; font-size: 15px; padding: 10px 12px; }

    /* 모바일: 전일대비, 고가, 저가 숨김 */
    .desktop-col { display: none !important; }

    .market-table { font-size: 12px; }
    .market-table th { padding: 8px 4px; font-size: 11px; }
    .market-table td { padding: 10px 4px; }
    .market-td-price { font-size: 14px; }
    .market-td-chg { font-size: 12px; }
    .market-td-vol { font-size: 11px; }
    .m-name { font-size: 13px; }
    .m-code { font-size: 10px; }
}

@media (max-width: 480px) {
    .market-page { padding: 8px; }
    .market-table td { padding: 9px 3px; }
    .market-td-price { font-size: 13px; }
}

/* ===== Gold Page (금현물) ===== */
.gold-page { height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden; }
.gold-header { background: var(--bg-secondary); border-bottom: 1px solid var(--border); padding: 8px 12px; flex-shrink: 0; }
.gold-product-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.gold-tab { padding: 5px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; color: var(--text-secondary); cursor: pointer; font-size: 12px; font-family: inherit; }
.gold-tab.active { background: #b8860b; color: #fff; border-color: #b8860b; }
.gold-price-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gp-price { font-size: 20px; font-weight: 700; }
.gp-change { font-size: 13px; }
.gp-info { font-size: 11px; color: var(--text-muted); margin-left: auto; }

.gold-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.gold-chart-col { flex: 1; display: flex; flex-direction: column; border-right: 1px solid var(--border); min-width: 0; }
#gold-chart-container { flex: 1; min-height: 200px; }

.gold-trade-col { width: 280px; display: flex; flex-direction: column; background: var(--bg-secondary); overflow-y: auto; }
.gold-trades-panel { border-bottom: 1px solid var(--border); max-height: 200px; overflow-y: auto; }
.gold-trades-header { padding: 6px 10px; font-size: 11px; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.gt-row { display: flex; padding: 3px 10px; font-size: 11px; gap: 8px; border-bottom: 1px solid rgba(255,255,255,0.02); }
.gt-time { color: var(--text-muted); width: 55px; }
.gt-price { flex: 1; text-align: right; font-weight: 500; }
.gt-qty { width: 50px; text-align: right; color: var(--text-secondary); }

@media (max-width: 768px) {
    .gold-page { height: auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(64px + 36px + env(safe-area-inset-bottom, 0px)); }
    .gold-body { flex-direction: column; }
    .gold-chart-col { height: 300px; flex: none; border-right: none; border-bottom: 1px solid var(--border); }
    #gold-chart-container { height: 260px; min-height: 0; }
    .gold-trade-col { width: 100%; }
    .gold-trades-panel { max-height: 150px; }
    .gp-price { font-size: 18px; }
    .gp-info { width: 100%; margin-left: 0; }
}

/* ===== Futures Page (선물) ===== */
.futures-page { height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden; }
.futures-header { background: var(--bg-secondary); border-bottom: 1px solid var(--border); padding: 8px 12px; flex-shrink: 0; }
.futures-tabs { display: flex; gap: 4px; margin-bottom: 6px; overflow-x: auto; scrollbar-width: none; }
.futures-tabs::-webkit-scrollbar { display: none; }
.fut-tab { padding: 5px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; color: var(--text-secondary); cursor: pointer; font-size: 12px; font-family: inherit; white-space: nowrap; }
.fut-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.futures-price-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fp-price { font-size: 20px; font-weight: 700; }
.fp-change { font-size: 13px; }
.fp-info { font-size: 11px; color: var(--text-muted); margin-left: auto; }

.futures-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.futures-chart-col { flex: 1; display: flex; flex-direction: column; border-right: 1px solid var(--border); min-width: 0; }
#futures-chart { flex: 1; min-height: 200px; }

.futures-trade-col { width: 280px; display: flex; flex-direction: column; background: var(--bg-secondary); overflow-y: auto; }
.futures-ob { border-bottom: 1px solid var(--border); }
.fob-header { display: flex; justify-content: space-between; padding: 4px 10px; font-size: 10px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.fob-row { display: flex; justify-content: space-between; padding: 4px 10px; font-size: 12px; cursor: pointer; font-variant-numeric: tabular-nums; }
.fob-row:hover { background: rgba(255,255,255,0.03); }
.fob-ask { background: rgba(59,130,246,0.03); }
.fob-bid { background: rgba(239,68,68,0.03); }
.fob-mid { text-align: center; padding: 6px; font-size: 14px; font-weight: 700; color: var(--text-primary); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

@media (max-width: 768px) {
    .futures-page { height: auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(64px + 36px + env(safe-area-inset-bottom, 0px)); }
    .futures-body { flex-direction: column; }
    .futures-chart-col { height: 300px; flex: none; border-right: none; border-bottom: 1px solid var(--border); }
    #futures-chart { height: 260px; min-height: 0; }
    .futures-trade-col { width: 100%; }
    .fp-price { font-size: 18px; }
    .fp-info { width: 100%; margin-left: 0; }
}

/* ===== Products Page (금융상품) ===== */
.products-page { padding: 16px; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.products-header { margin-bottom: 12px; }
.products-header h2 { font-size: 18px; }
.products-cats { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.products-cats::-webkit-scrollbar { display: none; }
.pcat-btn { padding: 7px 14px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 20px; color: var(--text-secondary); cursor: pointer; font-size: 12px; font-family: inherit; white-space: nowrap; transition: all 0.15s; }
.pcat-btn:hover { border-color: var(--accent); color: var(--accent); }
.pcat-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.products-list { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; align-content: start; padding-bottom: 20px; }
.products-empty { grid-column: 1/-1; text-align: center; padding: 60px 0; color: var(--text-muted); font-size: 14px; }

.product-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; cursor: pointer; transition: all 0.15s; }
.product-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.pc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pc-cat { font-size: 11px; color: var(--text-muted); }
.pc-status { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.st-active { background: rgba(22,163,74,0.15); color: #4ade80; }
.st-closed { background: rgba(220,38,38,0.15); color: #f87171; }
.st-upcoming { background: rgba(245,158,11,0.15); color: #fbbf24; }
.pc-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.pc-subtitle { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }
.pc-meta { display: flex; gap: 12px; }
.pc-meta-item { display: flex; flex-direction: column; gap: 2px; }
.pc-label { font-size: 10px; color: var(--text-muted); }
.pc-value { font-size: 12px; font-weight: 600; }
.pc-rate { color: #ef4444; }

/* Product Detail Modal */
.pdm-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.pdm-modal { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; padding: 24px; max-width: 500px; width: 100%; max-height: 80vh; overflow-y: auto; }
.pdm-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.pdm-close { margin-left: auto; background: none; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer; padding: 0 4px; }
.pdm-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.pdm-subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.pdm-stats { display: flex; gap: 16px; margin-bottom: 16px; padding: 12px; background: var(--bg-input); border-radius: 8px; }
.pdm-stat { display: flex; flex-direction: column; gap: 4px; }
.pdm-stat span { font-size: 10px; color: var(--text-muted); }
.pdm-stat b { font-size: 14px; }
.pdm-desc { font-size: 13px; line-height: 1.7; color: var(--text-secondary); }

@media (max-width: 768px) {
    .products-page { padding: 12px; padding-bottom: calc(64px + 36px + env(safe-area-inset-bottom, 0px)); }
    .products-list { grid-template-columns: 1fr; }
    .pc-meta { flex-wrap: wrap; }
    .pdm-stats { flex-direction: column; gap: 8px; }
}

/* ===== Products v2 (좌측 탭) ===== */
.products-page-v2 { padding: 0; height: 100%; display: flex; flex-direction: row; overflow: hidden; }
.pv2-sidebar { width: 200px; flex-shrink: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--bg-secondary); overflow-y: auto; }
.pv2-tab { padding: 16px 20px; background: none; border: none; border-left: 3px solid transparent; color: var(--text-secondary); cursor: pointer; font-size: 14px; font-family: inherit; font-weight: 500; text-align: left; transition: all 0.15s; }
.pv2-tab:hover { color: var(--text-primary); background: var(--bg-hover, rgba(255,255,255,0.03)); }
.pv2-tab.active { color: var(--accent); border-left-color: var(--accent); font-weight: 700; background: rgba(59,130,246,0.06); }
.pv2-content { flex: 1; display: flex; align-items: flex-start; padding: 32px 40px; overflow-y: auto; }
.pv2-body { width: 100%; max-width: 750px; display: flex; flex-direction: column; }
.pv2-desc { font-size: 17px; line-height: 2; color: var(--text-secondary); word-break: keep-all; margin-top: 20px; }

/* 배지/버튼 */
.pv2-badge { display: flex; }
.pv2-badge-top-right { justify-content: flex-end; margin-bottom: 8px; }
.pv2-badge-bottom-right { justify-content: flex-end; margin-top: 24px; }
.pv2-badge-closed { padding: 6px 18px; background: rgba(220,38,38,0.12); color: #f87171; border-radius: 6px; font-size: 13px; font-weight: 600; }
.pv2-badge-inquiry { padding: 6px 18px; background: rgba(251,191,36,0.12); color: #fbbf24; border-radius: 6px; font-size: 13px; font-weight: 600; }
.pv2-apply-btn { padding: 10px 24px; background: var(--accent); color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background 0.15s; }
.pv2-apply-btn:hover { background: #2563eb; }

@media (max-width: 768px) {
    .products-page-v2 { padding-bottom: calc(64px + 36px + env(safe-area-inset-bottom, 0px)); }
    .pv2-sidebar { width: 130px; }
    .pv2-tab { padding: 14px 12px; font-size: 12px; }
    .pv2-content { padding: 20px 16px; }
    .pv2-desc { font-size: 14px; line-height: 1.8; margin-top: 14px; }
    .pv2-apply-btn { padding: 10px 20px; font-size: 13px; }
}

/* ===== News Page ===== */
.news-page { max-width: 800px; margin: 0 auto; padding: 20px; overflow-y: auto; height: 100%; }
.news-page-title { font-size: 22px; font-weight: 700; margin-bottom: 20px; }
.news-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; padding: 0; margin-bottom: 12px; transition: all 0.15s; cursor: pointer; overflow: hidden; }
.news-card:hover { border-color: var(--accent); }
.news-card.open { border-color: var(--accent); }
.news-preview { display: flex; gap: 16px; padding: 16px; }
.news-img { width: 160px; height: 100px; flex-shrink: 0; border-radius: 6px; overflow: hidden; background: var(--bg-input); }
.news-img img { width: 100%; height: 100%; object-fit: cover; }
.news-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.news-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.news-source { font-size: 11px; color: var(--accent); font-weight: 600; }
.news-date { font-size: 11px; color: var(--text-muted); }
.news-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; line-height: 1.4; }
.news-card:not(.open) .news-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-summary { font-size: 12px; color: var(--text-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-card.open .news-summary { display: none; }
.news-full { padding: 0 16px 16px; border-top: 1px solid var(--border); margin-top: 0; }
.news-full-content { font-size: 14px; line-height: 1.9; color: var(--text-secondary); padding-top: 16px; }
.news-link { display: inline-block; margin-top: 16px; font-size: 13px; color: var(--accent); text-decoration: none; font-weight: 600; }
.news-link:hover { text-decoration: underline; }

@media (max-width: 768px) {
    .news-page { padding: 12px; padding-bottom: calc(64px + 36px + env(safe-area-inset-bottom, 0px)); }
    .news-preview { flex-direction: column; gap: 10px; }
    .news-img { width: 100%; height: 180px; }
    .news-title { font-size: 14px; }
    .news-full-content { font-size: 13px; line-height: 1.8; }
}

/* ===== CS Page (고객센터) ===== */
.cs-page { max-width: 650px; margin: 0 auto; padding: 16px; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.cs-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-shrink: 0; }
.cs-tab { padding: 10px 20px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-secondary); cursor: pointer; font-size: 14px; font-family: inherit; font-weight: 500; }
.cs-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.cs-body { flex: 1; overflow-y: auto; }
.cs-body h3 { font-size: 15px; margin-bottom: 12px; }

/* 문의 폼 */
.cs-inquiry-form { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.cs-select, .cs-textarea { width: 100%; padding: 10px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary); font-size: 13px; font-family: inherit; outline: none; margin-bottom: 8px; }
.cs-select:focus, .cs-textarea:focus { border-color: var(--accent); }
.cs-textarea { resize: vertical; min-height: 80px; }
.cs-submit-btn { padding: 10px 24px; background: var(--accent); color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; }
.cs-empty { text-align: center; padding: 30px; color: var(--text-muted); font-size: 13px; }

/* 문의 카드 */
.cs-inq-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 8px; }
.cs-inq-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cs-inq-cat { font-size: 12px; color: var(--accent); font-weight: 600; }
.cs-inq-status { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.st-pending { background: rgba(251,191,36,0.15); color: #fbbf24; }
.st-answered { background: rgba(22,163,74,0.15); color: #4ade80; }
.st-closed { background: rgba(107,114,128,0.15); color: #9ca3af; }
.cs-inq-content { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 6px; }
.cs-inq-date { font-size: 11px; color: var(--text-muted); }
.cs-inq-reply { margin-top: 10px; padding: 10px; background: var(--bg-input); border-radius: 6px; font-size: 13px; color: var(--text-primary); line-height: 1.6; }
.cs-reply-label { display: inline-block; font-size: 10px; color: var(--accent); font-weight: 700; margin-right: 6px; padding: 1px 6px; background: rgba(59,130,246,0.1); border-radius: 4px; }

/* 쪽지 카드 */
.cs-note-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; transition: border-color 0.15s; }
.cs-note-card:hover { border-color: var(--accent); }
.cs-note-card.unread { border-left: 3px solid var(--accent); }
.cs-note-top { display: flex; justify-content: space-between; align-items: center; }
.cs-note-title { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.cs-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.cs-note-date { font-size: 11px; color: var(--text-muted); }
.cs-note-body { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); line-height: 1.7; white-space: pre-wrap; }

@media (max-width: 768px) {
    .cs-page { padding: 12px; padding-bottom: calc(64px + 36px + env(safe-area-inset-bottom, 0px)); }
}
