/* Encounter Builder Styles */

#npc-tracker-root {
    font-size: 0.9rem;
}

/* ── Shared button ─────────────────────────────────────────────────────────── */
.nt-btn {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    border: 1px solid var(--gray-400, #adb5bd);
    border-radius: 4px;
    background: var(--gray-100, #f8f9fa);
    cursor: pointer;
    line-height: 1.4;
    white-space: nowrap;
    color: inherit;
}
.nt-btn:hover {
    background: var(--gray-200, #e9ecef);
}
.nt-btn-primary {
    background: #3b82f6;
    border-color: #2563eb;
    color: #fff;
}
.nt-btn-primary:hover {
    background: #2563eb;
}
.nt-btn-danger {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}
.nt-btn-danger:hover {
    background: #fecaca;
}
.nt-btn-sm {
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
}
.nt-btn-active {
    background: var(--gray-300, #dee2e6);
}

@media (prefers-color-scheme: dark) {
    .nt-btn {
        background: #374151;
        border-color: #4b5563;
        color: #e5e7eb;
    }
    .nt-btn:hover {
        background: #4b5563;
    }
    .nt-btn-primary {
        background: #2563eb;
        border-color: #1d4ed8;
        color: #fff;
    }
    .nt-btn-primary:hover {
        background: #1d4ed8;
    }
    .nt-btn-danger {
        background: #7f1d1d;
        border-color: #991b1b;
        color: #fecaca;
    }
    .nt-btn-danger:hover {
        background: #991b1b;
    }
    .nt-btn-active {
        background: #4b5563;
    }
}

/* ── Encounter bar ─────────────────────────────────────────────────────────── */
.nt-encounter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-300, #dee2e6);
}

.nt-enc-select {
    padding: 0.25rem 0.4rem;
    font-size: 0.85rem;
    border: 1px solid var(--gray-400, #adb5bd);
    border-radius: 4px;
    background: var(--gray-100, #f8f9fa);
    color: inherit;
    min-width: 140px;
}

@media (prefers-color-scheme: dark) {
    .nt-encounter-bar {
        border-color: #4b5563;
    }
    .nt-enc-select {
        background: #374151;
        border-color: #4b5563;
        color: #e5e7eb;
    }
}

/* ── Turn bar ──────────────────────────────────────────────────────────────── */
.nt-turn-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--gray-300, #dee2e6);
    border-radius: 6px;
    background: var(--gray-50, #fdfdfd);
}

.nt-turn-label {
    font-weight: 600;
    font-size: 0.95rem;
    margin-right: 0.5rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}
.nt-turn-players {
    background: #dbeafe;
    color: #1e40af;
}
.nt-turn-npcs {
    background: #fef3c7;
    color: #92400e;
}

@media (prefers-color-scheme: dark) {
    .nt-turn-bar {
        background: #1f2937;
        border-color: #4b5563;
    }
    .nt-turn-players {
        background: #1e3a5f;
        color: #93c5fd;
    }
    .nt-turn-npcs {
        background: #3b2a0a;
        color: #fcd34d;
    }
}

/* ── Add NPC panel ─────────────────────────────────────────────────────────── */
.nt-add-panel {
    margin-bottom: 1rem;
    border: 1px solid var(--gray-300, #dee2e6);
    border-radius: 6px;
    padding: 0.5rem;
}

.nt-search-input {
    width: 100%;
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
    border: 1px solid var(--gray-400, #adb5bd);
    border-radius: 4px;
    box-sizing: border-box;
    background: inherit;
    color: inherit;
}

.nt-search-results {
    list-style: none;
    margin: 0.4rem 0 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
}

.nt-search-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.3rem;
    border-bottom: 1px solid var(--gray-200, #f0f0f0);
}
.nt-search-item:last-child {
    border-bottom: none;
}

.nt-search-name {
    font-weight: 500;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.nt-search-stats {
    font-size: 0.75rem;
    color: var(--gray-500, #6b7280);
    white-space: nowrap;
}

.nt-search-empty {
    color: var(--gray-500, #6b7280);
    padding: 0.3rem;
    font-style: italic;
    list-style: none;
}

.nt-search-pc-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    background: #e0e7ff;
    color: #3730a3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nt-add-divider {
    margin: 0.5rem 0 0.35rem;
    font-size: 0.72rem;
    color: var(--gray-500, #6b7280);
    font-style: italic;
}

.nt-player-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.nt-player-input {
    flex: 1;
    padding: 0.25rem 0.4rem;
    font-size: 0.82rem;
    border: 1px solid var(--gray-400, #adb5bd);
    border-radius: 4px;
    background: inherit;
    color: inherit;
}

@media (prefers-color-scheme: dark) {
    .nt-add-panel {
        border-color: #4b5563;
    }
    .nt-search-input {
        border-color: #4b5563;
        background: #1f2937;
        color: #e5e7eb;
    }
    .nt-search-item {
        border-color: #374151;
    }
    .nt-search-stats {
        color: #9ca3af;
    }
    .nt-search-pc-badge {
        background: #312e81;
        color: #c7d2fe;
    }
    .nt-add-divider {
        color: #6b7280;
    }
    .nt-player-input {
        border-color: #4b5563;
        background: #1f2937;
        color: #e5e7eb;
    }
}

/* ── NPC card ──────────────────────────────────────────────────────────────── */
.nt-npc-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nt-card {
    border: 1px solid var(--gray-300, #dee2e6);
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}
.nt-card-inactive {
    opacity: 0.65;
}
.nt-card-eliminated {
    opacity: 0.4;
}
.nt-card-player {
    border-color: #a5b4fc;
}
.nt-card-stats-only {
    border-style: dashed;
}

.nt-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    user-select: none;
    background: var(--gray-50, #f9fafb);
    flex-wrap: wrap;
}
.nt-card-header:hover {
    background: var(--gray-100, #f3f4f6);
}
.nt-card-player > .nt-card-header {
    background: #eef2ff;
}
.nt-card-player > .nt-card-header:hover {
    background: #e0e7ff;
}

.nt-chevron {
    font-size: 0.65rem;
    color: var(--gray-500, #6b7280);
    flex-shrink: 0;
}

.nt-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.nt-strike {
    text-decoration: line-through;
}

.nt-header-stress {
    flex: 1;
    min-width: 0;
}

.nt-stress-dots {
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: 100%;
}
.nt-dot-filled {
    color: #dc2626;
}
.nt-dot-empty {
    color: var(--gray-300, #d1d5db);
}
.nt-stress-num {
    font-size: 0.75rem;
    color: var(--gray-500, #6b7280);
}

.nt-header-stat {
    font-size: 0.8rem;
    white-space: nowrap;
    color: var(--gray-600, #4b5563);
}
.nt-header-mana {
    color: #7c3aed;
}

.nt-status-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.nt-status-active {
    background: #dcfce7;
    color: #166534;
}
.nt-status-inactive {
    background: #f3f4f6;
    color: #6b7280;
}
.nt-status-eliminated {
    background: #fee2e2;
    color: #991b1b;
}

.nt-player-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    background: #e0e7ff;
    color: #3730a3;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nt-stats-only-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

@media (prefers-color-scheme: dark) {
    .nt-card {
        background: #1f2937;
        border-color: #4b5563;
    }
    .nt-card-player {
        border-color: #4338ca;
    }
    .nt-card-header {
        background: #111827;
    }
    .nt-card-header:hover {
        background: #1a2433;
    }
    .nt-card-player > .nt-card-header {
        background: #1e1b4b;
    }
    .nt-card-player > .nt-card-header:hover {
        background: #2e2770;
    }
    .nt-dot-empty {
        color: #4b5563;
    }
    .nt-stress-num {
        color: #9ca3af;
    }
    .nt-header-stat {
        color: #9ca3af;
    }
    .nt-header-mana {
        color: #a78bfa;
    }
    .nt-status-active {
        background: #14532d;
        color: #86efac;
    }
    .nt-status-inactive {
        background: #374151;
        color: #9ca3af;
    }
    .nt-status-eliminated {
        background: #7f1d1d;
        color: #fca5a5;
    }
    .nt-player-badge {
        background: #312e81;
        color: #c7d2fe;
    }
    .nt-stats-only-badge {
        background: #374151;
        color: #9ca3af;
    }
}

/* ── Card body ─────────────────────────────────────────────────────────────── */
.nt-card-body {
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-top: 1px solid var(--gray-200, #e5e7eb);
}

.nt-body-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.nt-body-row-top {
    align-items: center;
    gap: 0.5rem;
}

.nt-name-input {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.2rem 0.4rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    flex: 1;
    min-width: 100px;
}
.nt-name-input:hover, .nt-name-input:focus {
    border-color: var(--gray-400, #9ca3af);
    background: var(--gray-50, #f9fafb);
    outline: none;
}

.nt-status-group {
    display: flex;
    gap: 2px;
}
.nt-status-btn {
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--gray-300, #dee2e6);
    background: var(--gray-100, #f8f9fa);
    cursor: pointer;
    color: inherit;
}
.nt-status-btn:first-child { border-radius: 4px 0 0 4px; }
.nt-status-btn:last-child  { border-radius: 0 4px 4px 0; }
.nt-status-btn:hover { background: var(--gray-200, #e9ecef); }
.nt-status-btn-active {
    background: #374151;
    color: #f9fafb;
    border-color: #374151;
}

@media (prefers-color-scheme: dark) {
    .nt-card-body {
        border-top-color: #374151;
    }
    .nt-name-input:hover, .nt-name-input:focus {
        border-color: #6b7280;
        background: #111827;
    }
    .nt-status-btn {
        background: #374151;
        border-color: #4b5563;
        color: #e5e7eb;
    }
    .nt-status-btn:hover { background: #4b5563; }
    .nt-status-btn-active {
        background: #e5e7eb;
        color: #111827;
        border-color: #e5e7eb;
    }
}

/* ── Personal traits line ──────────────────────────────────────────────────── */
.nt-personal-traits {
    font-size: 0.78rem;
    font-style: italic;
    color: var(--gray-500, #6b7280);
    padding: 0.1rem 0 0.2rem;
    border-bottom: 1px solid var(--gray-100, #f3f4f6);
}

@media (prefers-color-scheme: dark) {
    .nt-personal-traits {
        color: #9ca3af;
        border-bottom-color: #374151;
    }
}

/* ── Stat controls ─────────────────────────────────────────────────────────── */
.nt-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.nt-stat-control {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nt-stat-label {
    font-size: 0.75rem;
    color: var(--gray-500, #6b7280);
    margin-right: 0.1rem;
    white-space: nowrap;
}

.nt-stat-value {
    min-width: 1.8rem;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
}

.nt-stat-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--gray-300, #dee2e6);
    border-radius: 3px;
    background: var(--gray-100, #f8f9fa);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: inherit;
}
.nt-stat-btn:hover { background: var(--gray-200, #e9ecef); }

@media (prefers-color-scheme: dark) {
    .nt-stat-label { color: #9ca3af; }
    .nt-stat-btn {
        background: #374151;
        border-color: #4b5563;
        color: #e5e7eb;
    }
    .nt-stat-btn:hover { background: #4b5563; }
}

/* ── Traits / conditions ───────────────────────────────────────────────────── */
.nt-traits-row {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.nt-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: flex-start;
}

.nt-pill-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

.nt-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.4rem;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 500;
}

.nt-pill-name {
    cursor: pointer;
}
.nt-pill-name:hover {
    text-decoration: underline dotted;
}

.nt-pill-value {
    width: 2.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    border-bottom: 1px solid #93c5fd;
    background: transparent;
    color: inherit;
    text-align: center;
    padding: 0;
    -moz-appearance: textfield;
}
.nt-pill-value::-webkit-inner-spin-button,
.nt-pill-value::-webkit-outer-spin-button { -webkit-appearance: none; }

.nt-pill-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #1e40af;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.1rem;
}
.nt-pill-remove:hover { color: #991b1b; }

.nt-pill-desc {
    font-size: 0.72rem;
    color: var(--gray-600, #4b5563);
    background: var(--gray-50, #f9fafb);
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    max-width: 260px;
    line-height: 1.35;
}

.nt-add-trait {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.nt-trait-select {
    padding: 0.15rem 0.3rem;
    font-size: 0.78rem;
    border: 1px solid var(--gray-300, #dee2e6);
    border-radius: 4px;
    background: var(--gray-100, #f8f9fa);
    color: inherit;
}

.nt-custom-trait {
    padding: 0.15rem 0.35rem;
    font-size: 0.78rem;
    border: 1px solid var(--gray-300, #dee2e6);
    border-radius: 4px;
    width: 90px;
    background: inherit;
    color: inherit;
}

@media (prefers-color-scheme: dark) {
    .nt-pill {
        background: #1e3a5f;
        color: #93c5fd;
    }
    .nt-pill-value { border-bottom-color: #3b82f6; }
    .nt-pill-remove { color: #93c5fd; }
    .nt-pill-remove:hover { color: #fca5a5; }
    .nt-pill-desc {
        color: #d1d5db;
        background: #1f2937;
        border-color: #374151;
    }
    .nt-trait-select, .nt-custom-trait {
        background: #374151;
        border-color: #4b5563;
        color: #e5e7eb;
    }
}

/* ── Has Acted / Notes ─────────────────────────────────────────────────────── */
.nt-acted-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
    cursor: pointer;
    user-select: none;
}

.nt-notes {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.8rem;
    padding: 0.3rem 0.4rem;
    border: 1px solid var(--gray-300, #dee2e6);
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    background: inherit;
    color: inherit;
}

@media (prefers-color-scheme: dark) {
    .nt-notes {
        background: #111827;
        border-color: #4b5563;
        color: #e5e7eb;
    }
}

/* ── Ref sections (Abilities, Actions, Powers, etc.) ──────────────────────── */
.nt-ref-section {
    border-top: 1px solid var(--gray-200, #e5e7eb);
    padding-top: 0.4rem;
}

.nt-ref-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gray-500, #6b7280);
    margin-bottom: 0.25rem;
}

.nt-ref-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nt-ref-item {
    font-size: 0.82rem;
    line-height: 1.4;
}

.nt-action-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.05rem 0.35rem;
    border-radius: 3px;
    background: var(--gray-200, #e5e7eb);
    color: var(--gray-700, #374151);
    letter-spacing: 0.04em;
    vertical-align: middle;
}

.nt-chaos {
    font-size: 0.75rem;
    color: #b45309;
    font-style: italic;
}

.nt-action-desc {
    color: var(--gray-500, #6b7280);
    font-size: 0.78rem;
}

.nt-power-improvements {
    margin: 0.2rem 0 0 1rem;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1.5;
}
.nt-power-improvements li {
    margin: 0;
    padding: 0;
}

@media (prefers-color-scheme: dark) {
    .nt-ref-section {
        border-top-color: #374151;
    }
    .nt-ref-title { color: #9ca3af; }
    .nt-action-badge {
        background: #374151;
        color: #d1d5db;
    }
    .nt-chaos { color: #fbbf24; }
    .nt-action-desc { color: #9ca3af; }
}

/* ── Skills section ────────────────────────────────────────────────────────── */
.nt-skills-section {
    border-top: 1px solid var(--gray-200, #e5e7eb);
    padding-top: 0.4rem;
}

.nt-skills-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gray-500, #6b7280);
    margin-bottom: 0.35rem;
}

.nt-skill-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.3rem;
}

.nt-skill-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 0.2rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: var(--gray-100, #f3f4f6);
    border: 1px solid var(--gray-200, #e5e7eb);
    font-size: 0.78rem;
}

.nt-skill-name {
    color: var(--gray-500, #6b7280);
}

.nt-skill-score {
    color: var(--gray-800, #1f2937);
    font-size: 0.85rem;
}

.nt-focus-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.nt-focus-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 0.2rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    font-size: 0.78rem;
}

.nt-focus-name {
    color: #3b82f6;
}

.nt-focus-score {
    color: #1d4ed8;
    font-size: 0.85rem;
}

@media (prefers-color-scheme: dark) {
    .nt-skills-section {
        border-top-color: #374151;
    }
    .nt-skills-title { color: #9ca3af; }
    .nt-skill-chip {
        background: #374151;
        border-color: #4b5563;
    }
    .nt-skill-name { color: #9ca3af; }
    .nt-skill-score { color: #e5e7eb; }
    .nt-focus-chip {
        background: #1e3a5f;
        border-color: #2563eb;
    }
    .nt-focus-name { color: #60a5fa; }
    .nt-focus-score { color: #93c5fd; }
}

/* ── Edit panel ────────────────────────────────────────────────────────────── */
.nt-edit-panel {
    background: var(--gray-50, #fafafa);
    border-top: 2px solid #3b82f6;
}

.nt-edit-title {
    font-weight: 600;
    font-size: 0.85rem;
    flex: 1;
}

.nt-edit-label {
    font-size: 0.78rem;
    color: var(--gray-600, #4b5563);
    white-space: nowrap;
    min-width: 7rem;
}

.nt-edit-num {
    width: 4rem;
    padding: 0.2rem 0.35rem;
    font-size: 0.82rem;
    border: 1px solid var(--gray-400, #adb5bd);
    border-radius: 4px;
    background: inherit;
    color: inherit;
    -moz-appearance: textfield;
}
.nt-edit-num::-webkit-inner-spin-button,
.nt-edit-num::-webkit-outer-spin-button { -webkit-appearance: none; }

.nt-edit-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gray-500, #6b7280);
    margin-top: 0.2rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--gray-200, #e5e7eb);
}

.nt-edit-skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.nt-edit-skill-wrap {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.nt-edit-focus-items {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.nt-edit-focus-name {
    flex: 1;
    min-width: 100px;
    padding: 0.2rem 0.35rem;
    font-size: 0.82rem;
    border: 1px solid var(--gray-400, #adb5bd);
    border-radius: 4px;
    background: inherit;
    color: inherit;
}

@media (prefers-color-scheme: dark) {
    .nt-edit-panel {
        background: #111827;
        border-top-color: #2563eb;
    }
    .nt-edit-label { color: #9ca3af; }
    .nt-edit-num {
        border-color: #4b5563;
        background: #1f2937;
        color: #e5e7eb;
    }
    .nt-edit-section-title {
        color: #9ca3af;
        border-top-color: #374151;
    }
    .nt-edit-focus-name {
        border-color: #4b5563;
        background: #1f2937;
        color: #e5e7eb;
    }
}

/* ── Header traits ─────────────────────────────────────────────────────────── */
.nt-header-traits {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.2rem;
}

.nt-header-trait-pill {
    display: inline-block;
    padding: 0.05rem 0.35rem;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    background: #fef3c7;
    color: #92400e;
    white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
    .nt-header-trait-pill {
        background: #3b2a0a;
        color: #fcd34d;
    }
}

/* ── Instances badge ───────────────────────────────────────────────────────── */
.nt-instances-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    background: #f0fdf4;
    color: #166534;
    font-weight: 600;
    letter-spacing: 0.03em;
    border: 1px solid #bbf7d0;
}

@media (prefers-color-scheme: dark) {
    .nt-instances-badge {
        background: #14532d;
        color: #86efac;
        border-color: #166534;
    }
}

/* ── Instances section ─────────────────────────────────────────────────────── */
.nt-instances-section {
    border-top: 2px solid var(--gray-200, #e5e7eb);
    padding-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.nt-instances-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gray-500, #6b7280);
    margin-bottom: 0.1rem;
}

@media (prefers-color-scheme: dark) {
    .nt-instances-section { border-top-color: #374151; }
    .nt-instances-title { color: #9ca3af; }
}

/* ── Instance block ────────────────────────────────────────────────────────── */
.nt-instance-block {
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 5px;
    background: var(--gray-50, #f9fafb);
    overflow: hidden;
}
.nt-instance-eliminated { opacity: 0.4; }
.nt-instance-inactive { opacity: 0.65; }

.nt-instance-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.55rem;
    cursor: pointer;
    user-select: none;
    background: var(--gray-100, #f3f4f6);
    flex-wrap: wrap;
}
.nt-instance-header:hover { background: var(--gray-200, #e9ecef); }

.nt-instance-name {
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.nt-instance-body {
    padding: 0.45rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border-top: 1px solid var(--gray-200, #e5e7eb);
}

.nt-acted-badge {
    font-size: 0.65rem;
    padding: 0.08rem 0.35rem;
    border-radius: 10px;
    background: #fef9c3;
    color: #854d0e;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nt-card-has-instances {
    border-color: #6ee7b7;
}

@media (prefers-color-scheme: dark) {
    .nt-instance-block {
        background: #1a2433;
        border-color: #374151;
    }
    .nt-instance-header {
        background: #1f2937;
    }
    .nt-instance-header:hover { background: #273345; }
    .nt-instance-body { border-top-color: #374151; }
    .nt-acted-badge {
        background: #422006;
        color: #fcd34d;
    }
    .nt-card-has-instances {
        border-color: #059669;
    }
}

/* ── Empty states ──────────────────────────────────────────────────────────── */
.nt-empty {
    color: var(--gray-500, #6b7280);
    font-style: italic;
    margin: 1rem 0;
}
