/* ═══════════════════════════════════════════════════════════
   Lists — vertical item lists (the "list-group" pattern)
   A card-framed stack of rows used for pickable results and
   multi-select panels: user search results, role assignment,
   product selection. Rows can be plain, links/buttons (hover),
   or selectable (.is-selected, teal). Pair the leading control
   with checks.css for multi-select.
   ═══════════════════════════════════════════════════════════ */

.tn-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--tn-border);
    border-radius: var(--tn-radius-lg);
    overflow: hidden;
    background: var(--tn-bg-card);
}

.tn-list-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--tn-space-sm);
    width: 100%;
    padding: 10px 14px;
    background: var(--tn-bg-card);
    border: none;
    border-bottom: 1px solid var(--tn-border-light);
    color: var(--tn-text-primary);
    font-size: var(--tn-font-size-sm);
    font-family: inherit;
    text-align: left;
    text-decoration: none;
}

.tn-list-item:last-child {
    border-bottom: none;
}

/* Interactive rows (rendered as <button>/<a> or given this class) */
.tn-list-item--action {
    cursor: pointer;
    transition: background var(--tn-transition);
}

.tn-list-item--action:hover {
    background: var(--tn-bg-hover);
}

.tn-list-item--action:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--tn-accent);
}

/* Selected / active row */
.tn-list-item.is-selected,
.tn-list-item.is-active {
    background: var(--tn-accent-light);
    color: var(--tn-accent);
    font-weight: 500;
}

/* Success-toned row — a completed/fulfilled state, distinct from
   is-selected: that's a SELECTION (accent), this is a STATUS (green). A
   row can be both at once (selected AND done), so this is additive, not
   a replacement for is-selected. */
.tn-list-item.is-success {
    background: var(--tn-success-light);
    color: var(--tn-success-text);
}

.tn-list-item.is-success .tn-list-item-title {
    color: var(--tn-success-text);
}

/* ── Status rail — a 4px full-height colour bar at the row's leading
   edge, for scannable status-at-a-glance in a dense list (order state,
   priority). Different affordance from .tn-category-dot (tables.css) —
   a dot marks a value inside a cell, a rail marks the row itself. Needs
   the row's own left padding increased so text doesn't sit under it:
     <div class="tn-list-item" style="padding-left:20px">
       <span class="tn-list-item-rail tn-list-item-rail--amber"></span>
       …
     </div>
   Five tones, matching badges.css's set so a product can reuse the same
   status→tone mapping in both places. ── */
.tn-list-item-rail {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.tn-list-item-rail--blue { background: var(--tn-accent); }
.tn-list-item-rail--amber { background: var(--tn-warning); }
.tn-list-item-rail--green { background: var(--tn-success); }
.tn-list-item-rail--red { background: var(--tn-danger); }
.tn-list-item-rail--gray { background: var(--tn-text-secondary); }

/* Flush variant — no outer frame, for embedding inside a card/section */
.tn-list--flush {
    border: none;
    border-radius: 0;
    background: transparent;
}

/* A title + sub-line stacked inside a row (e.g. name over email) */
.tn-list-item-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.tn-list-item-title {
    font-weight: 600;
    color: var(--tn-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tn-list-item.is-selected .tn-list-item-title {
    color: var(--tn-accent);
}

.tn-list-item-sub {
    font-size: var(--tn-font-size-xs);
    color: var(--tn-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Trailing element (check mark, badge) pushed to the right */
.tn-list-item-trail {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--tn-accent);
}

/* ── Mobile density — rows sit on a 16px gutter rhythm and keep a
   comfortable 44px touch target (Apple HIG min) even when tightened. ── */
@media (max-width: 640px) {
    .tn-list-item {
        padding: 11px var(--tn-space-md);
        min-height: 44px;
    }
}
