/* ── Portfolio page-specific styles ── */

/* Scroll offset so section titles are visible when navigated via info-bar links */
#open-pos-section,
#closed-pos-section {
    scroll-margin-top: 44px;
}

/* ── Custom Dropdown ── */
.custom-dropdown {
    position: relative;
    margin-left: auto;
}
@media (max-width: 768px) {
    .custom-dropdown { margin-left: 0; }
}

/* Dropdown trigger — voice element, speaks B2 (matches subtitle).
   Panel chrome around it stays --cockpit-accent (mint-teal). */
.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid rgba(var(--b2-rgb), 0.25);
    background: rgba(var(--b2-rgb), 0.06);
    color: var(--b2-soft);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.dropdown-trigger:hover {
    border-color: rgba(var(--b2-rgb), 0.45);
    background: rgba(var(--b2-rgb), 0.10);
}

.dropdown-arrow {
    color: var(--b2-soft);
    transition: transform 0.2s;
}

.custom-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 100%;
    z-index: 100;
    background: #161e22;                                       /* brand Slate Card */
    border: 1px solid rgba(var(--b2-rgb), 0.15);
    border-radius: 6px;
    padding: 4px 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.custom-dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-item {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s;
}

.dropdown-item:hover {
    background: rgba(var(--b2-rgb), 0.08);
    color: #fff;
}

.dropdown-item-active {
    color: var(--b2-soft);
    background: rgba(var(--b2-rgb), 0.06);
}

/* universe-strip styles live in common.css (shared with viewer) */

.chart-container {
    width: 100%;
    height: 360px;
    border-radius: 3px;
    overflow: hidden;
}

/* Loading skeleton — visible until LightweightCharts injects child elements */
.chart-container:empty {
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.02) 0%,
        rgba(255, 255, 255, 0.06) 50%,
        rgba(255, 255, 255, 0.02) 100%
    );
    background-size: 200% 100%;
    animation: chart-skeleton-shimmer 1.6s ease-in-out infinite;
}

@keyframes chart-skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* KPI value skeleton — same shimmer as chart-container, sized to a number */
.kpi-skeleton {
    display: inline-block;
    border-radius: 4px;
    vertical-align: middle;
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(255, 255, 255, 0.10) 50%,
        rgba(255, 255, 255, 0.04) 100%
    );
    background-size: 200% 100%;
    animation: chart-skeleton-shimmer 1.6s ease-in-out infinite;
}

.kpi-skeleton-num {
    width: 88px;
    height: 0.7em;
}

.kpi-skeleton-num-sm {
    width: 52px;
    height: 0.7em;
}

.cell-agents {
    font-size: 11px;
    color: var(--text-dim);
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Module chip styles moved to common.css for cross-page reuse. */

/* ── Sortable table headers ── */
th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    color: var(--accent);
}

.sort-arrow {
    font-size: 9px;
    color: var(--accent);
    margin-left: 2px;
}

@media (max-width: 768px) {
    .chart-container {
        height: 280px;
    }
}

/* ══════════════════════════════════
   KPI Grid — enhanced layout
   ══════════════════════════════════ */

/* .kpi-label-tip / .kpi-tooltip / .kpi-tip-icon → common.css (shared brand pattern,
   matches utils.js TRIGGER_SEL `.kpi-label-tip`). */

/* Info bar tweaks */
.info-bar .info-val {
    margin-left: 2px;
}

.info-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed rgba(var(--b2-rgb), 0.30);       /* B2 voice */
    transition: color 0.15s, border-color 0.15s;
    cursor: pointer;
}

.info-link:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* KPI grid 5-column layout */
.kpi-grid-idea {
    grid-template-columns: repeat(5, 1fr);
    align-items: stretch;
    margin-top: 4px;
}

.kpi-grid-idea>.kpi-card,
.kpi-grid-idea>.kpi-card-donut,
.kpi-grid-idea>.kpi-card-gauge {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    text-align: center;
}

.kpi-grid-idea .kpi-label {
    text-align: left;
    color: var(--b2-soft);
    text-shadow: 0 0 6px rgba(var(--b2-rgb), 0.18);
}

.kpi-grid-idea>.kpi-card .kpi-value {
    font-size: 26px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 0;
}

.kpi-grid-idea .kpi-sub {
    color: #c8d6e5;
    text-align: left;
    margin-top: auto;
    font-size: 10px;
    white-space: nowrap;
}

.kpi-card-donut .kpi-sub,
.kpi-card-gauge .kpi-sub {
    text-align: center;
}

/* Win Rate Donut */
.kpi-card-donut {
    display: flex;
    flex-direction: column;
}

.donut-mini-wrap {
    position: relative;
    width: 88px;
    height: 88px;
    margin: 2px auto 4px;
    flex: 1;
    display: flex;
    align-items: center;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

.donut-mini-svg {
    width: 100%;
    height: 100%;
    transform: scaleX(-1) rotate(-90deg);
}

.donut-mini-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 12;
}

.donut-mini-fill-win {
    fill: none;
    stroke: var(--positive);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dasharray 0.8s ease;
    filter: drop-shadow(0 0 5px rgba(var(--positive-rgb), 0.5));
}

.donut-mini-fill-loss {
    fill: none;
    stroke: var(--negative);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dasharray 0.8s ease;
    filter: drop-shadow(0 0 5px rgba(var(--negative-rgb), 0.5));
}

.donut-mini-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-mini-val {
    font-size: 14px;
    font-weight: 800;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    line-height: 1;
    text-shadow: 0 0 10px rgba(var(--positive-rgb), 0.3);
}

/* Leverage Gauge */
.kpi-card-gauge {
    display: flex;
    flex-direction: column;
}

.lev-gauge-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    margin: 0 auto 2px;
}

.lev-gauge-svg {
    width: 150px;
    height: auto;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
}

@media (max-width: 900px) {
    .kpi-grid-idea {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 580px) {
    .kpi-grid-idea {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Coin Insights 2-col grid ── */
.coin-insights-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.coin-insights-grid>.cockpit-section {
    min-width: 0;
}

.coin-insights-grid .chart-legend,
.cockpit-section>div>.chart-legend {
    flex-wrap: wrap;
    gap: 6px 16px;
}

.coin-insights-grid .table-wrap .cockpit-table {
    width: auto;
    min-width: 0;
}

.coin-insights-grid .table-wrap .cockpit-table thead th {
    padding: 10px 14px;
    white-space: nowrap;
    font-size: 11px;
}

.coin-insights-grid .table-wrap .cockpit-table tbody td {
    padding: 12px 14px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .coin-insights-grid {
        grid-template-columns: 1fr;
    }
}

.coin-open-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    vertical-align: middle;
    margin-left: 3px;
    box-shadow: 0 0 4px 1px rgba(99, 102, 241, 0.45);
}