.grid-header {
    position: sticky;
    top: 0;
    z-index: 4; /* above rows and sticky cells */
}

#dnaHeaderSpacer {
   display:none !important;   
}
.portfolio-sync-layout {
    padding: 6px;
}

.main-col {
    padding-right: 8px;
        /* Allow flex item to shrink below intrinsic content width to prevent early wrap */
    min-width: 0;
    max-height: 94vh !important;
}


.chat-col {
    width: 300px;
    min-width: 220px;
    max-width: 60vw;
    padding-left: 6px;
    border-left: 1px solid var(--border-light);
}

.chat-resizer {
    width: 6px;
    cursor: col-resize;
    background: var(--border-light);
    padding: 0;
    margin: 0 4px;
}

.top-toolbar {
    padding: 4px;
}

.top-toolbar .btn {
    padding: 2px 8px;
    font-size: 0.85rem;
}

.form-select-sm, .form-label.small {
    font-size: 0.85rem;
}

.portfolio-filter-wrapper {
  padding: 4px;   
}

.portfolio-filter-wrapper label {
    padding: 4px;   
}

#portfolioFilterModal { 
    .pf-dialog, .pf-header, .pf-grid-wrap  {
        background: black;
    }
}

.grid {
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 0px;
    min-height: 120px;
}

.portfolio-grid {
    height: calc(100vh - 170px);
    overflow-x: auto; /* single scroll container for x */
    overflow-y: auto; /* and y */
    background: white;
    position: relative;
    xscrollbar-gutter: stable both-edges;
}

.portfolio-grid-top-level-view-wrapper {
    background-color: #e9e9e9;
    color: navy;
    overflow: visible;  /* do not create a new scroll container */
    height: 98%;
    min-height: 0; /* allow child flex to shrink for scrolling */
    width: max-content; /* expand to content width; outer container scrolls */
    display: none;
}

/* Grid layout containers for independent vertical and horizontal scrolling */
.grid-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    align-items: flex-start; /* don't stretch header/body to container width */
    width: max-content;      /* size to intrinsic grid width so outer container can scroll */
}

.grid-body {
    flex: 1 1 auto;
    overflow: visible;  /* vertical scroll handled by .portfolio-grid */
    width: max-content;
    min-height: 0;
}


.small {
    font-size: 0.85rem;
}


    .cell.fixed-col {
        background: #fff;
    }

.grid-header, .grid-header .fixed-col {
   display: inline-flex;
   width: max-content;
   background: #dae6ee;
   background: linear-gradient(0deg, rgb(189 227 254) 0%, rgb(219 228 238) 54%, rgb(192 225 255) 100%);
    border-radius: 5px;
    color: navy;
}


.grid-row {
    display: flex;
    width: max-content;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
}


.grid-row.selected {
    background: #b2caeb !important;
        color: #3861f6;

}

.grid-row.category-header {
    background: #f8f9fa;
    color: blue;
    font-weight: bold;
    cursor: pointer;
}

.grid-row.category-header:hover {
    background: #7a9bbc;
}

.grid-row.category-collapsed {
    display: none;
}

.cell {
    padding: 4px 8px;
    border-right: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    white-space:nowrap;
    box-sizing: border-box;
    flex: 0 0 auto;
}

.cell:last-child {
    border-right: none;
}

.cell.editable {
    cursor: text;
    position: relative;
}

.cell.editable:hover {
    background: rgba(0, 123, 255, 0.1);
}

.cell input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    padding: 2px;
}

.cell input:focus {
    background: white;
    border: 1px solid #007bff;
    border-radius: 2px;
}

.percentage-cell {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.percentage-cell.positive {
    color: #28a745;
}

.percentage-cell.negative {
    color: #dc3545;
}

.category-toggle {
    margin-right: 8px;
    font-size: 0.8rem;
    color: #6c757d;
}

/* Nested child grids */
.child-grid {
    margin-left: 0 !important;
    padding-left: 0 !important;
    border-left: none !important;
}
.child-grid.level-1 { margin-left: 20px; }
.child-grid.level-2 { margin-left: 40px; }
.child-grid.level-3 { margin-left: 60px; }
.child-grid.level-4 { margin-left: 80px; }

/* Server-provided CssClass is applied directly on .child-grid containers */


.security-symbol {
    font-weight: 500;
}

.market-value {
    font-family: 'Courier New', monospace;
    text-align: right;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-indicator.synced {
    background: #28a745;
}

.status-indicator.pending {
    background: #ffc107;
}

.status-indicator.error {
    background: #dc3545;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.summary-footer {
    /* color: navy; */
    position: sticky;
    bottom: 0;
    background: var(--surface-1);
    border-top: 2px solid var(--border-medium);
    padding: 8px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    background-color: white;
}

.ByIssuerSectorView .grid-row:nth(odd) {
    background: lightblue;
}

.ByIssuerView {
    background: #eeeeee;
    margin-left: 40px !important;
    color: navy;
    font-weight:500;
    
}

.ByIssuerView .grid-row:nth-child(odd)  {
    background: #d3e5fd;
}





/* .AllPositionsView { background: lightblue; }  -- removed to avoid empty ruleset lint */


/* These set Server-Side */
.cell-market-value {
    justify-content: flex-end !important;
    padding-right: 10px;
}

.cell-percent {
    justify-content: flex-end !important;
}

.flex {
    display: flex;
}

.play-button {
    color: #67c167;
    opacity: 0.1
}


.grid-row:hover {
    background: #bbbbe4;
}
.grid-row.selected:hover {
    background: #a6b5ce;
    color: #687fe4;
}

/* Fixed (pinned) column behavior */
.cell.fixed-col {
    position: sticky;
    left: var(--fixed-left, 0px);
    z-index: 2;
}




.grid-header .cell.fixed-col {
    z-index: 3;
}

.cell.fixed-placeholder {
    background: transparent;
    box-shadow: none;
    border-right: none;
}
