/* ── NAV Table columns ──────────────────────────────────────────────────── */
.col-ticker {
    width: 30%;
}

.col-listed {
    width: 35%;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.col-nav {
    width: 35%;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.cc-table th.col-listed,
.cc-table th.col-nav {
    text-align: right;
}

/* ── Sortable column headers ─────────────────────────────────────────────── */
.cc-table th[data-sort-col] {
    user-select: none;
    transition: color 0.15s;
}

.cc-table th[data-sort-col]:hover {
    color: var(--text-primary);
}

.cc-table th[data-sort-col]::after {
    content: ' ⇅';
    opacity: 0.35;
    font-size: 0.65rem;
}

.cc-table th[data-sort-col].sort-desc::after {
    content: ' ▼';
    opacity: 0.9;
    color: #8b5cf6;
}

.cc-table th[data-sort-col].sort-asc::after {
    content: ' ▲';
    opacity: 0.9;
    color: #8b5cf6;
}

@media (max-width: 640px) {

    /* 모바일: 아이콘 숨기고, 컬럼 너비 재조정 */
    .cc-table th[data-sort-col]::after,
    .cc-table th[data-sort-col].sort-desc::after,
    .cc-table th[data-sort-col].sort-asc::after {
        display: none;
    }

    .col-ticker {
        width: 30%;
    }

    .col-listed {
        width: 35%;
    }

    .col-nav {
        width: 35%;
    }

    .cc-table-wrapper {
        overflow-x: hidden;
    }

    .cc-table th,
    .cc-table td {
        font-size: 0.72rem;
        padding: 0.4rem 0.35rem;
        word-break: break-all;
    }
}

/* Ticker: code badge + name inline */
.ticker-code {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    vertical-align: middle;
}

.ticker-name {
    display: inline;
    margin-left: 0.45rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    vertical-align: middle;
}

@media (max-width: 640px) {
    .ticker-name {
        display: none;
    }
}

/* ── Toggle Bar ─────────────────────────────────────────────────────────── */
.dt-toggle-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: var(--bg-secondary);
    padding: 0.3rem;
    border-radius: 8px;
    width: fit-content;
}

.dt-toggle-btn {
    padding: 0.35rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
}

.dt-toggle-btn.active {
    background: var(--accent-gradient, linear-gradient(135deg, #6366f1, #8b5cf6));
    color: #fff;
}

/* ── LevInv Net Row ─────────────────────────────────────────────────────── */
.li-net-row td {
    border-top: 1px solid rgba(139, 92, 246, 0.4);
    font-weight: 700;
    background: rgba(139, 92, 246, 0.09);
}

.li-net-row:hover td {
    background: rgba(139, 92, 246, 0.14) !important;
}

/* ── LevInv Group Divider (KOSPI200 / KOSDAQ150 구분선) ─────────────────── */
.li-group-divider td {
    padding: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #8b5cf6 20%, #6366f1 80%, transparent);
    border: none;
    pointer-events: none;
}

.li-group-divider:hover td {
    background: linear-gradient(90deg, transparent, #8b5cf6 20%, #6366f1 80%, transparent) !important;
}

/* ── Page Header ────────────────────────────────────────────────────────── */
.cc-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0 0.25rem;
}

.cc-page-header h2 {
    font-size: 1rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cc-updated {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ── Section Card ───────────────────────────────────────────────────────── */
.cc-section {
    margin-bottom: 1rem;
}

.cc-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.75rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cc-section-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cc-badge {
    font-size: 0.67rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 0.1rem 0.5rem;
    white-space: nowrap;
}

/* ── Table ──────────────────────────────────────────────────────────────── */
.cc-table-wrapper {
    overflow-x: auto;
    padding: 0 1rem 1rem;
}

.cc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.cc-table th {
    text-align: left;
    padding: 0.45rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.cc-table td {
    padding: 0.5rem 0.6rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.cc-table tr:last-child td {
    border-bottom: none;
}

.cc-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

/* Column widths */
.col-name {
    width: 55%;
}

.col-dir {
    width: 15%;
    text-align: center;
}

.col-qty {
    width: 30%;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.cc-table th.col-dir {
    text-align: center;
}

.cc-table th.col-qty {
    text-align: right;
}

/* Direction badges */
.dir-sell {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    white-space: nowrap;
}

.dir-buy {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    white-space: nowrap;
}

.cc-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
    font-size: 0.8rem;
}

/* ── Mobile name switching ──────────────────────────────────────────────── */
.name-short {
    display: none;
}

.name-full {
    display: inline;
}

@media (max-width: 640px) {
    .name-full {
        display: none;
    }

    .name-short {
        display: inline;
    }
}

/* ── Histogram ──────────────────────────────────────────────────────────── */
.cc-chart-container {
    padding: 0 1rem 1rem;
    position: relative;
}

#ccHistogram {
    min-height: 180px;
}

.li-net-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding: 0 1rem 1rem;
}

.li-net-chart-panel {
    min-width: 0;
}

.li-net-chart-title {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.45rem;
}

.li-net-chart-box {
    height: 260px;
    position: relative;
}

.li-net-chart-box canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.li-net-chart-empty {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}

@media (max-width: 768px) {
    .li-net-chart-grid {
        grid-template-columns: 1fr;
    }

    .li-net-chart-box {
        height: 240px;
    }
}
