.index-stock {
    /* Masonry layout eliminates vertical blank spaces between different list sizes */
    column-width: 140px;
    column-gap: 12px;
    font-size: 0.8em;
}

.index-grid {
    /* Prevents letter blocks from splitting across column boundaries */
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 12px;
    display: block;
}

.index-card-body {
    padding: 0.75em;
}

.index-grid ul {
    list-style-type: none;
    font-size: 1em;
    padding-left: 0 !important;
    margin-bottom: 0;
}

.index-grid li {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between; /* Pushes badges to the far right */
    line-height: 1.6em;
    border-bottom: 1px dotted #ccc;
    padding-bottom: 0.2em;
    margin-bottom: 0.3em;
}

/* Stock link & category group container */
.index-grid li .text-truncate,
.index-grid li .flex-row {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex: 1; /* Takes available space on the left */
}

.index-grid li a {
    text-decoration: none;
    font-weight: 600;
}

.index-grid li a:hover {
    text-decoration: underline;
}

/* Margin badges pinned strictly to the right side */
.margin-badges {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: auto; /* Guarantees right alignment */
    flex-shrink: 0;    /* Prevents badges from getting squished */
}

.margin-badges .badge {
    display: inline-block;
    font-size: 8px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

/* Mobile Responsiveness */
@media screen and (max-width: 980px) {
    .index-stock {
        column-width: 110px;
        column-gap: 8px;
    }
}