.shell-app.is-narrative-events-view .shell-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0;
}

.shell-app.is-narrative-events-view .shell-content,
.shell-app.is-narrative-events-view .shell-panel,
.shell-app.is-narrative-events-view .explorer-shell,
.shell-app.is-narrative-events-view .explorer-shell__main,
.shell-app.is-narrative-events-view .explorer-shell__content {
    min-width: 0;
}

.shell-app.is-narrative-events-view .shell-content,
.shell-app.is-narrative-events-view .shell-panel {
    padding: 0;
}

.shell-app.is-narrative-events-view .shell-panel {
    min-height: calc(100vh - var(--shell-header-height));
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.shell-app.is-narrative-events-view .explorer-shell {
    width: 100%;
}

.shell-app.is-narrative-events-view .explorer-shell__toolbar {
    align-items: center;
    overflow: visible;
}

.shell-app.is-narrative-events-view .explorer-shell__toolbar-left,
.shell-app.is-narrative-events-view .explorer-shell__toolbar-center,
.shell-app.is-narrative-events-view .explorer-shell__toolbar-right {
    min-height: 34px;
}

.shell-app.is-narrative-events-view .explorer-shell__toolbar-center {
    justify-content: center;
    overflow: visible;
}

.shell-app.is-narrative-events-view .explorer-shell__toolbar-right {
    overflow: visible;
}

.shell-app.is-narrative-events-view .explorer-shell__content {
    overflow: hidden;
}

.shell-app.is-narrative-events-view .explorer-shell__panel--right .explorer-shell__panel-body {
    padding: 0;
}

.narrative-events-view-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--m2p-border-subtle);
    border-radius: 8px;
    background: var(--m2p-bg-surface-muted);
}

.narrative-events-view-switch__button {
    min-height: 26px;
    padding: 4px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--m2p-text-secondary);
    font: inherit;
    font-size: 0.78rem;
    line-height: 1;
    cursor: pointer;
}

.narrative-events-view-switch__button:hover {
    color: var(--m2p-text-primary);
    background: var(--m2p-bg-surface-hover);
}

.narrative-events-view-switch__button.is-active {
    color: var(--m2p-text-primary);
    background: var(--m2p-bg-surface);
    box-shadow: 0 0 0 1px var(--m2p-border-subtle);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view {
    --shell-bg: var(--m2p-bg-app);
    --shell-bg-soft: var(--m2p-bg-surface-muted);
    --shell-chrome: var(--m2p-bg-sidebar);
    --shell-panel: var(--m2p-bg-surface);
    --shell-panel-strong: var(--m2p-bg-surface);
    --shell-control: var(--m2p-bg-surface);
    --shell-line: var(--m2p-border-subtle);
    --shell-line-strong: var(--m2p-border-strong);
    --shell-text: var(--m2p-text-primary);
    --shell-text-soft: var(--m2p-text-secondary);
    --shell-accent: var(--m2p-accent);
    --shell-accent-strong: var(--m2p-accent);
    --shell-accent-hover: var(--m2p-accent-hover);
    --shell-accent-soft: var(--m2p-accent-soft);
    --shell-shadow: 0 14px 36px rgba(15, 23, 42, .08);
    --text_muted: var(--m2p-text-secondary);
    --text_soft: var(--m2p-text-muted);
    --surface_hover: var(--m2p-bg-surface-hover);
    --selected_background: var(--m2p-selected-bg);
    --narrative-canvas-bg: var(--m2p-bg-app);
    --narrative-sidebar-bg: var(--m2p-bg-surface-muted);
    --narrative-table-header-bg: var(--m2p-bg-surface-muted);
    --narrative-row-hover-bg: var(--m2p-bg-surface-hover);
    --narrative-row-selected-bg: var(--m2p-selected-bg);
    --narrative-row-selected-border: var(--m2p-selected-border);
    --narrative-thread-track-strength: 14%;
    --narrative-thread-track-opacity: .28;
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .explorer-shell {
    background: var(--narrative-canvas-bg);
}

:root[data-theme="light"] body.app-shell-body:has(.shell-app.is-narrative-events-view) {
    background: var(--narrative-canvas-bg);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .shell-sidebar {
    background: var(--m2p-bg-sidebar);
    border-right-color: var(--shell-line);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .shell-header {
    border-bottom-color: var(--shell-line);
    background: color-mix(in srgb, var(--m2p-bg-surface) 94%, transparent);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .shell-brand {
    border-color: var(--shell-line);
    background: var(--m2p-bg-surface);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .explorer-shell__panel {
    background: var(--shell-panel);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .explorer-shell__panel--left {
    background: var(--narrative-sidebar-bg);
    border-right-color: var(--shell-line);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .explorer-shell__panel--right {
    background: var(--shell-panel);
    border-left-color: var(--shell-line);
    box-shadow: -10px 0 28px rgba(15, 23, 42, .045);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .explorer-shell__main {
    background: var(--narrative-canvas-bg);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .explorer-shell__toolbar {
    border-bottom-color: var(--shell-line);
}

.narrative-events {
    display: grid;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.narrative-events__summary,
.narrative-events__actions,
.narrative-events__form-actions,
.narrative-events__step-actions,
.narrative-events__filter-counters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.narrative-events__actions .is-active {
    color: var(--shell-accent);
    border-color: var(--shell-accent);
    background: var(--shell-accent-soft);
}

.narrative-events__menu-wrap,
.narrative-events__thread-bar {
    position: relative;
}

.narrative-events__menu,
.narrative-events__thread-picker {
    position: absolute;
    z-index: 30;
    top: calc(100% + 7px);
    right: 0;
    min-width: 230px;
    padding: 7px;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius);
    background: var(--shell-panel-strong);
    box-shadow: 0 14px 32px rgba(0, 0, 0, .22);
}

.narrative-events__menu button {
    width: 100%;
    padding: 9px;
    border: 0;
    border-radius: 5px;
    color: var(--shell-text);
    text-align: left;
    background: transparent;
}

.narrative-events__menu button:hover {
    background: var(--surface_hover);
}

.narrative-events__alert {
    padding: 9px 10px;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius-sm);
    color: var(--shell-text);
    background: var(--shell-accent-soft);
}

.narrative-events__alert.is-error {
    color: var(--shell-danger);
}

.narrative-events__filters {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.shell-app.is-narrative-events-view .explorer-shell__panel--left .explorer-shell__panel-body,
.shell-app.is-narrative-events-view .explorer-shell__panel--left .narrative-events__filters,
.shell-app.is-narrative-events-view .explorer-shell__panel--left .ui-filter-control {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.shell-app.is-narrative-events-view .explorer-shell__panel--left .ui-filter-control__select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shell-app.is-narrative-events-view .explorer-shell__panel--left .icon-dropdown,
.shell-app.is-narrative-events-view .explorer-shell__panel--left .icon-dropdown__details {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.shell-app.is-narrative-events-view .explorer-shell__panel--left .icon-dropdown__trigger {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.shell-app.is-narrative-events-view .explorer-shell__panel--left .icon-dropdown__trigger .icon-dropdown__option-content {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.narrative-events__panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.narrative-events__panel-title strong {
    color: var(--shell-text);
    font-size: .82rem;
}

.narrative-events__panel-title button,
.narrative-events__step-actions button {
    padding: 0;
    border: 0;
    color: var(--shell-accent);
    background: transparent;
    font: inherit;
}

.narrative-events__filter-toggles {
    display: grid;
    gap: 8px;
}

.narrative-events__check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--shell-text);
    font-size: .78rem;
}

.narrative-events__check input,
.narrative-events__thread-picker input,
.narrative-events__step-required input {
    width: auto;
}

.narrative-events__filter-counters {
    padding-top: 4px;
}

.narrative-events__thread-bar {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--shell-text-soft);
    font-size: .78rem;
}

.narrative-events__thread-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.narrative-events__thread-view-mode {
    flex: 0 1 auto;
}

.narrative-events__thread-focus {
    display: grid;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius-sm);
    background: color-mix(in srgb, var(--shell-panel) 84%, var(--shell-bg));
}

.narrative-events__thread-focus-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--shell-text-soft);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.narrative-events__thread-focus-heading .shell-inline-button {
    min-height: 26px;
    padding: 4px 7px;
    font-size: .72rem;
    text-transform: none;
    letter-spacing: 0;
}

.narrative-events__selected-thread-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-width: 0;
}

.narrative-events__thread-focus-empty {
    color: var(--shell-text-soft);
    font-size: .76rem;
}

.narrative-events__selected-thread-chip {
    display: inline-flex;
    max-width: 240px;
    min-height: 26px;
    align-items: center;
    gap: 6px;
    padding: 3px 7px;
    border: 1px solid color-mix(in srgb, var(--thread-color) 38%, var(--shell-line));
    border-radius: 999px;
    color: var(--shell-text);
    background: color-mix(in srgb, var(--thread-color) 10%, var(--shell-panel));
    font-size: .74rem;
    line-height: 1.1;
}

.narrative-events__selected-thread-chip button {
    display: inline-flex;
    width: 16px;
    height: 16px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--shell-text-soft);
    background: transparent;
    cursor: pointer;
}

.narrative-events__selected-thread-chip button:hover {
    color: var(--shell-accent-strong);
    background: color-mix(in srgb, var(--thread-color) 14%, transparent);
}

.narrative-events__selected-thread-chip button svg {
    width: 12px;
    height: 12px;
}

.narrative-events__thread-bar > button {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    gap: 6px;
    padding: 7px 9px;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius-sm);
    color: var(--shell-text);
    background: var(--shell-control);
    font: inherit;
}

.narrative-events__thread-bar > button:hover {
    border-color: var(--shell-line-strong);
    background: var(--surface_hover);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .shell-badge,
:root[data-theme="light"] .shell-app.is-narrative-events-view .shell-chip {
    border-color: var(--m2p-border-subtle);
    color: var(--m2p-text-secondary);
    background: var(--m2p-bg-surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .shell-action-button,
:root[data-theme="light"] .shell-app.is-narrative-events-view .shell-inline-button,
:root[data-theme="light"] .shell-app.is-narrative-events-view .explorer-shell__panel-toggle,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__thread-bar > button,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__order-buttons button {
    border-color: var(--m2p-border-subtle);
    color: var(--shell-text);
    background: var(--m2p-bg-surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .shell-action-button:hover,
:root[data-theme="light"] .shell-app.is-narrative-events-view .shell-inline-button:hover,
:root[data-theme="light"] .shell-app.is-narrative-events-view .explorer-shell__panel-toggle:hover,
:root[data-theme="light"] .shell-app.is-narrative-events-view .explorer-shell__panel-toggle:focus,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__thread-bar > button:hover,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__order-buttons button:hover {
    border-color: var(--shell-line-strong);
    background: var(--m2p-bg-surface-hover);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .shell-action-button.is-primary {
    border-color: var(--shell-accent-strong);
    background: var(--shell-accent-strong);
    color: var(--m2p-accent-text);
}

.narrative-events__thread-picker {
    right: auto;
    left: 70px;
    display: grid;
    gap: 3px;
}

.narrative-events__thread-picker label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px;
    color: var(--shell-text);
    font-size: .78rem;
}

.narrative-events__thread-picker span,
.narrative-events__thread-add > span,
.narrative-events__step-heading > span {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: var(--thread-color);
}

.narrative-events__table-wrap {
    width: 100%;
    min-width: 0;
    overflow: auto;
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__table-wrap {
    padding: 8px;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius);
    background: var(--shell-panel);
    box-shadow: var(--shell-shadow);
}

.narrative-events__table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0 4px;
    table-layout: auto;
    font-size: .8rem;
}

.narrative-events__table th,
.narrative-events__table td {
    padding: 9px 10px;
    vertical-align: middle;
    text-align: left;
}

.narrative-events__table th {
    position: sticky;
    z-index: 5;
    top: 0;
    color: var(--shell-text-soft);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: var(--shell-bg);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__table th {
    color: var(--m2p-text-muted);
    background: var(--narrative-table-header-bg);
}

.narrative-events__table td {
    border-top: 1px solid var(--shell-line);
    border-bottom: 1px solid var(--shell-line);
    background: var(--shell-panel);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__table td {
    border-color: var(--m2p-border-subtle);
    background: var(--m2p-bg-surface);
}

.narrative-events__table td:first-child {
    border-left: 1px solid var(--shell-line);
    border-radius: var(--shell-radius-sm) 0 0 var(--shell-radius-sm);
}

.narrative-events__table td:last-child {
    border-right: 1px solid var(--shell-line);
    border-radius: 0 var(--shell-radius-sm) var(--shell-radius-sm) 0;
}

.narrative-events__table tr:hover td {
    border-color: var(--shell-line-strong);
    background: var(--surface_hover);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__table tr:hover td {
    border-color: var(--shell-line-strong);
    background: var(--narrative-row-hover-bg);
}

.narrative-events__table tr[data-narrative-event-row] {
    cursor: pointer;
}

.narrative-events__table tr[data-narrative-event-row].is-pressing td,
.narrative-events__table tr[data-narrative-event-row].is-drag-ready td {
    border-color: color-mix(in srgb, var(--shell-accent) 28%, var(--shell-line));
    background: color-mix(in srgb, var(--shell-accent-soft) 18%, var(--shell-panel));
    user-select: none;
}

.narrative-events__table tr[data-narrative-event-row].is-drag-ready {
    cursor: grab;
}

.narrative-events__table tr.narrative-events__row--thread-active:not(.is-selected) td {
    border-color: color-mix(in srgb, var(--shell-accent) 34%, var(--shell-line));
    background: color-mix(in srgb, var(--shell-accent-soft) 38%, var(--shell-panel));
}

.narrative-events__table tr.narrative-events__row--thread-active:not(.is-selected) td:first-child {
    box-shadow: inset 3px 0 0 color-mix(in srgb, var(--shell-accent) 70%, transparent);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__table tr.narrative-events__row--thread-active:not(.is-selected) td {
    border-color: color-mix(in srgb, var(--m2p-accent) 28%, var(--m2p-border-subtle));
    background: color-mix(in srgb, var(--m2p-accent-soft) 32%, var(--m2p-bg-surface));
}

.narrative-events__table tr.is-selected td {
    border-color: var(--shell-accent);
    background: var(--shell-accent-soft);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__table tr.is-selected td {
    border-color: var(--narrative-row-selected-border);
    background: var(--narrative-row-selected-bg);
}

.narrative-events__table tr.is-dragging td {
    border-style: dashed;
    border-color: color-mix(in srgb, var(--shell-accent) 42%, var(--shell-line));
    opacity: .46;
    cursor: grabbing;
    user-select: none;
}

.narrative-events__table tr.is-drag-over-before td {
    border-top-color: var(--shell-accent-strong);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--shell-accent-strong) 72%, transparent);
}

.narrative-events__table tr.is-drag-over-after td {
    border-bottom-color: var(--shell-accent-strong);
    box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--shell-accent-strong) 72%, transparent);
}

.narrative-events__table tr.is-drag-over-before td:first-child {
    border-top-left-radius: var(--shell-radius-sm);
}

.narrative-events__table tr.is-drag-over-after td:first-child {
    border-bottom-left-radius: var(--shell-radius-sm);
}

.narrative-events__table tr.is-drag-over-before td:last-child {
    border-top-right-radius: var(--shell-radius-sm);
}

.narrative-events__table tr.is-drag-over-after td:last-child {
    border-bottom-right-radius: var(--shell-radius-sm);
}

.narrative-events__table tr.is-drop-neighbor td {
    transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.narrative-events__drop-placeholder {
    pointer-events: none;
}

.narrative-events__drop-placeholder td {
    padding: 2px 10px;
    border: 0;
    background: transparent;
}

.narrative-events__drop-placeholder-card {
    width: 100%;
    min-height: 8px;
    border: 1px solid color-mix(in srgb, var(--shell-accent) 46%, var(--shell-line));
    border-radius: 999px;
    background: color-mix(in srgb, var(--shell-accent-soft) 34%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--shell-accent) 14%, transparent);
    transition: min-height 120ms ease, background 120ms ease, border-color 120ms ease;
}

.narrative-events__drop-placeholder.is-expanded .narrative-events__drop-placeholder-card {
    min-height: 16px;
    border-color: color-mix(in srgb, var(--shell-accent) 64%, var(--shell-line));
    background: color-mix(in srgb, var(--shell-accent-soft) 46%, transparent);
}

.narrative-events__table th:nth-child(1),
.narrative-events__table td:nth-child(1) {
    min-width: 40px;
}

.narrative-events__table .is-order {
    width: 42px;
    min-width: 42px;
    text-align: center;
}

.narrative-events__table .is-event {
    width: auto;
    min-width: 300px;
}

.narrative-events__table .is-reference {
    width: 150px;
    min-width: 130px;
    color: var(--shell-text-soft);
    white-space: nowrap;
}

.narrative-events__table .is-notes {
    width: 64px;
    min-width: 58px;
    text-align: center;
}

.narrative-events__event-title {
    display: inline-flex;
    padding: 0;
    border: 0;
    color: var(--shell-text);
    font: inherit;
    font-weight: 650;
    text-align: left;
    background: transparent;
}

.narrative-events__table td.is-event {
    display: table-cell;
}

.narrative-events__event-title:hover {
    color: var(--shell-accent-strong);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__event-title:hover,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__event-title:focus {
    color: var(--m2p-accent-hover);
}

.narrative-events__description {
    display: -webkit-box;
    min-width: 160px;
    margin-top: 3px;
    overflow: hidden;
    color: var(--shell-text-soft);
    font-size: .74rem;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.narrative-events__reference-stack {
    display: inline-flex;
    max-width: 180px;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.narrative-events__notes-indicator {
    display: inline-flex;
    min-width: 24px;
    min-height: 22px;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--shell-text-soft);
    font-size: .66rem;
    line-height: 1;
    opacity: .58;
}

.narrative-events__notes-indicator svg {
    width: 13px;
    height: 13px;
}

.narrative-events__notes-indicator.has-notes {
    opacity: .9;
    color: var(--shell-accent-strong);
}

.narrative-events__notes-indicator.has-notes span {
    min-width: 14px;
    padding: 2px 4px;
    border: 1px solid var(--shell-line);
    border-radius: 999px;
    color: var(--shell-text-soft);
    background: var(--shell-control);
}

.narrative-events__linked-threads {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.narrative-events__linked-threads.has-pending {
    padding-left: 6px;
    border-left: 2px solid var(--shell-accent);
}

.narrative-events__thread-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    min-width: 0;
}

.narrative-events__thread-chip {
    display: inline-flex;
    max-width: 170px;
    min-height: 22px;
    align-items: center;
    gap: 5px;
    padding: 2px 5px;
    border: 1px solid color-mix(in srgb, var(--thread-color) 34%, var(--shell-line));
    border-radius: 999px;
    color: var(--shell-text);
    background: color-mix(in srgb, var(--thread-color) 11%, var(--shell-panel));
    font-size: .7rem;
    line-height: 1.1;
}

.narrative-events__thread-chip-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: var(--thread-color);
}

.narrative-events__thread-chip-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.narrative-events__thread-chip button,
.narrative-events__add-thread {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    color: var(--shell-text-soft);
    background: transparent;
    cursor: pointer;
}

.narrative-events__thread-chip button {
    width: 16px;
    height: 16px;
    padding: 0;
    border-radius: 50%;
}

.narrative-events__thread-chip button:hover,
.narrative-events__add-thread:hover {
    color: var(--shell-accent-strong);
}

.narrative-events__thread-chip button svg {
    width: 12px;
    height: 12px;
}

.narrative-events__add-thread {
    justify-self: start;
    gap: 4px;
    min-height: 22px;
    padding: 0;
    font: inherit;
    font-size: .7rem;
}

.narrative-events__add-thread svg {
    width: 13px;
    height: 13px;
}

.narrative-events__table .is-thread {
    width: 70px;
    min-width: 70px;
    text-align: center;
}

.narrative-events__table td.is-thread {
    position: relative;
    overflow: visible;
}

.narrative-events__table td.is-thread::before {
    content: "";
    position: absolute;
    top: -5px;
    bottom: -5px;
    left: 50%;
    z-index: 0;
    width: 2px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--thread-color) var(--narrative-thread-track-strength, 34%), transparent);
    opacity: var(--narrative-thread-track-opacity, .5);
    transform: translateX(-50%);
    pointer-events: none;
}

.narrative-events__table th.is-thread > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: var(--thread-color);
}

.narrative-events__thread-type-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    object-fit: contain;
}

.narrative-events__thread-cell {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    display: inline-flex;
    width: 100%;
    min-width: 0;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
    border: 1px dashed transparent;
    border-radius: 999px;
    color: var(--shell-text-soft);
    background: transparent;
    font: inherit;
    overflow: visible;
    isolation: isolate;
}

.narrative-events__thread-cell.has-step {
    min-height: 32px;
}

.narrative-events__thread-cell:not(.has-step):hover {
    border-color: var(--shell-line-strong);
    background: var(--shell-control);
}

.narrative-events__thread-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 11px;
    height: 11px;
    flex: 0 0 11px;
    border-radius: 50%;
    background: var(--thread-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--thread-color) 18%, transparent);
    transform: translate(-50%, -50%);
}

.narrative-events__thread-cell.has-step small {
    position: absolute;
    top: 50%;
    left: calc(50% + 10px);
    z-index: 2;
    transform: translateY(-50%);
}

.narrative-events__thread-cell.is-empty {
    opacity: .35;
}

.narrative-events__thread-cell.is-empty:hover {
    opacity: 1;
}

.narrative-events__thread-add-mark {
    opacity: 0;
    color: var(--shell-accent-strong);
    font-weight: 800;
}

.narrative-events__thread-cell.is-empty:hover .narrative-events__thread-add-mark {
    opacity: 1;
}

.narrative-events__thread-cell small {
    color: var(--shell-text-soft);
    font-size: .64rem;
}

.narrative-events__drag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.narrative-events__drag-handle {
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--shell-text-soft);
    cursor: inherit;
}

.narrative-events__drag-handle:hover {
    border-color: var(--shell-line);
    color: var(--shell-text);
    background: var(--surface_hover);
}

.narrative-events__drag-handle[aria-disabled="true"] {
    cursor: default;
    opacity: .42;
}

.narrative-events__drag-handle svg {
    width: 15px;
    height: 15px;
}

.narrative-events__table tr.is-dragging .narrative-events__drag-handle {
    cursor: grabbing;
    color: var(--shell-accent-strong);
    background: var(--shell-accent-soft);
}

.narrative-events__order-buttons button {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--shell-line);
    border-radius: 5px;
    color: var(--shell-text);
    background: var(--shell-control);
}

.narrative-events__order-buttons button:disabled {
    opacity: .45;
}

.narrative-events__drag-ghost {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    max-width: min(320px, 42vw);
    min-height: 12px;
    padding: 3px 10px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--shell-accent) 48%, var(--shell-line));
    border-radius: 999px;
    color: var(--shell-text);
    background: color-mix(in srgb, var(--shell-panel) 84%, var(--shell-accent-soft));
    box-shadow: 0 10px 22px rgba(0, 0, 0, .2);
    font-size: .68rem;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    opacity: .88;
    transform-origin: top left;
    transition: none;
}

.narrative-events__inspector {
    min-width: 0;
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__inspector {
    min-height: calc(100vh - var(--shell-header-height) - 20px);
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius);
    background: var(--shell-panel);
    box-shadow: var(--shell-shadow);
    overflow: hidden;
}

.narrative-events__inspector-header,
.narrative-events__event-form,
.narrative-events__inspector-section,
.narrative-events__inspector-empty {
    padding: 14px;
}

.narrative-events__inspector-header {
    position: sticky;
    z-index: 4;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--shell-line);
    background: var(--shell-panel);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__inspector-header {
    background: var(--m2p-bg-surface);
}

.narrative-events__inspector-header h2 {
    margin: 0;
    font-size: 1rem;
}

.narrative-events__inspector-header button {
    border: 0;
    color: var(--shell-text-soft);
    background: transparent;
}

.narrative-events__event-form {
    display: grid;
    gap: 14px;
}

.narrative-events__event-form label {
    display: grid;
    gap: 7px;
    color: var(--shell-text-soft);
    font-size: .76rem;
    font-weight: 650;
}

.narrative-events__event-form input,
.narrative-events__event-form select,
.narrative-events__event-form textarea,
.narrative-events__step input,
.narrative-events__step textarea {
    width: 100%;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius-sm);
    color: var(--shell-text);
    background: var(--shell-control);
    font: inherit;
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .shell-search,
:root[data-theme="light"] .shell-app.is-narrative-events-view .ui-filter-control__select,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__event-form input,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__event-form select,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__event-form textarea,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__step input,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__step textarea,
:root[data-theme="light"] .shell-app.is-narrative-events-view .icon-dropdown__trigger,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-thread-filters__treeselect .treeselect-input {
    border-color: var(--m2p-border-subtle);
    background: var(--m2p-bg-surface);
    color: var(--shell-text);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .shell-search:focus,
:root[data-theme="light"] .shell-app.is-narrative-events-view .ui-filter-control__select:focus,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__event-form input:focus,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__event-form select:focus,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__event-form textarea:focus,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__step input:focus,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__step textarea:focus {
    border-color: var(--shell-accent);
    outline: 0;
    box-shadow: 0 0 0 3px var(--m2p-focus-ring);
}

.narrative-events__event-form input,
.narrative-events__event-form select,
.narrative-events__event-form textarea {
    padding: 8px 9px;
}

.narrative-events__event-form textarea,
.narrative-events__step textarea {
    resize: vertical;
}

.narrative-events__inspector-section {
    display: grid;
    gap: 10px;
    border-top: 1px solid var(--shell-line);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__inspector-section {
    border-top-color: var(--m2p-border-subtle);
}

.narrative-events__inspector-section h3 {
    margin: 0;
    font-size: .82rem;
}

.narrative-events__inspector-empty {
    display: grid;
    gap: 8px;
    align-content: start;
    color: var(--shell-text-soft);
    text-align: center;
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__inspector-empty {
    min-height: calc(100vh - var(--shell-header-height) - 52px);
    align-content: center;
    justify-items: center;
    background: linear-gradient(180deg, var(--m2p-bg-surface) 0%, var(--m2p-bg-app) 100%);
}

.narrative-events__inspector-empty h2 {
    margin: 0;
    color: var(--shell-text);
    font-size: 1rem;
}

.narrative-events__inspector-empty p {
    margin: 0;
}

.narrative-events__thread-add {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 0;
    border: 0;
    color: var(--shell-text-soft);
    text-align: left;
    background: transparent;
    font: inherit;
}

.narrative-events__step {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius-sm);
    background: var(--shell-bg-soft);
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__step,
:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__meta {
    border-color: var(--m2p-border-subtle);
    background: var(--m2p-bg-app);
}

.narrative-events__step.is-focused {
    border-color: var(--shell-accent);
    box-shadow: 0 0 0 3px var(--shell-accent-soft);
}

.narrative-events__step-heading,
.narrative-events__meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.narrative-events__step-heading small {
    margin-left: auto;
    color: var(--shell-text-soft);
}

.narrative-events__step-fields {
    display: grid;
    grid-template-columns: .75fr 1.15fr .75fr;
    gap: 6px;
}

.narrative-events__step-fields input,
.narrative-events__step textarea {
    padding: 6px;
    font-size: .72rem;
}

.narrative-events__meta {
    justify-content: space-between;
    padding: 8px 10px;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius-sm);
    color: var(--shell-text-soft);
    background: var(--shell-bg-soft);
    font-size: .74rem;
}

.narrative-events__meta strong {
    color: var(--shell-text);
}

.narrative-events__step-required {
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 7px;
    color: var(--shell-text-soft);
    font-size: .72rem;
    font-weight: 400 !important;
}

.narrative-events__step-actions {
    justify-content: flex-end;
    font-size: .72rem;
}

.narrative-events__step-actions .is-danger {
    color: var(--shell-danger);
}

.narrative-events__reference {
    display: flex;
    gap: 8px;
}

.narrative-events__reference span {
    display: grid;
    flex: 1;
    gap: 2px;
}

.narrative-events__reference button {
    align-self: flex-start;
    padding: 2px;
    border: 0;
    color: var(--shell-text-soft);
    background: transparent;
}

.narrative-events__reference small,
.narrative-events__muted {
    color: var(--shell-text-soft);
}

.narrative-events__empty {
    padding: 34px;
    color: var(--shell-text-soft);
    text-align: center;
}

:root[data-theme="light"] .shell-app.is-narrative-events-view .narrative-events__empty {
    color: var(--m2p-text-muted);
}

@media (max-width: 980px) {
    .narrative-events__thread-bar,
    .narrative-events__actions {
        justify-content: flex-start;
    }

    .narrative-events__step-fields {
        grid-template-columns: 1fr;
    }
}

.narrative-thread-modal {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 26px;
}

.narrative-thread-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .62);
    backdrop-filter: blur(4px);
}

.narrative-thread-modal__dialog {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(1180px, calc(100vw - 48px));
    height: min(780px, calc(100vh - 48px));
    overflow: visible;
    border: 1px solid var(--shell-line);
    border-radius: 14px;
    background: var(--shell-panel);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .44);
}

.narrative-thread-modal__header,
.narrative-thread-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--shell-line);
}

.narrative-thread-modal__header h2 {
    margin: 0;
    font-size: 1.08rem;
}

.narrative-thread-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius-sm);
    color: var(--shell-text);
    background: var(--shell-control);
}

.narrative-thread-modal__body {
    display: grid;
    grid-template-columns: 250px minmax(360px, 1fr) 280px;
    min-height: 0;
    overflow: visible;
}

.narrative-thread-modal__filters,
.narrative-thread-modal__selected {
    min-width: 0;
    overflow: auto;
    padding: 14px;
    background: var(--shell-bg-soft);
}

.narrative-thread-modal__filters {
    position: relative;
    z-index: 5;
    overflow: visible;
    border-right: 1px solid var(--shell-line);
}

.narrative-thread-modal__selected {
    border-left: 1px solid var(--shell-line);
}

.narrative-thread-filters {
    display: grid;
    gap: 12px;
}

.icon-dropdown {
    position: relative;
}

.icon-dropdown__details {
    position: relative;
}

.icon-dropdown__details > summary {
    list-style: none;
}

.icon-dropdown__details > summary::-webkit-details-marker {
    display: none;
}

.icon-dropdown__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 34px;
    padding: 7px 9px;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius-sm);
    background: var(--shell-control);
    color: var(--shell-text);
    cursor: pointer;
    font: inherit;
}

.icon-dropdown__trigger:hover,
.icon-dropdown__details[open] .icon-dropdown__trigger {
    border-color: var(--shell-line-strong);
}

.icon-dropdown__trigger > svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    color: var(--shell-text-soft);
}

.icon-dropdown__details[open] .icon-dropdown__trigger > svg {
    transform: rotate(180deg);
}

.icon-dropdown__menu {
    position: absolute;
    z-index: 1030;
    top: calc(100% + 4px);
    left: 0;
    display: grid;
    width: 100%;
    min-width: 210px;
    max-height: min(260px, calc(100vh - 180px));
    overflow: auto;
    padding: 4px;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius-sm);
    background: var(--shell-panel);
    box-shadow: var(--shell-shadow);
}

.icon-dropdown__option {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 32px;
    padding: 6px 7px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--shell-text);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.icon-dropdown__option:hover,
.icon-dropdown__option:focus,
.icon-dropdown__option.is-selected {
    background: var(--shell-bg-soft);
}

.icon-dropdown__option-content {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 8px;
}

.icon-dropdown__option-content span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-dropdown__icon,
.icon-dropdown__icon-placeholder {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.icon-dropdown__icon {
    object-fit: contain;
}

.narrative-thread-filters__structure {
    display: grid;
    gap: 7px;
}

.narrative-thread-filters__treeselect {
    min-width: 0;
    min-height: 42px;
}

.narrative-thread-filters__treeselect.m2p-narrative-treeselect--modal-filter {
    position: relative;
}

.narrative-thread-filters__treeselect.m2p-narrative-treeselect--summary-trigger .treeselect-input {
    position: relative;
    min-height: 42px !important;
    height: 42px !important;
    max-height: 42px !important;
    overflow: hidden !important;
    align-items: center;
}

.narrative-thread-filters__treeselect.m2p-narrative-treeselect--summary-trigger .treeselect-input__tags,
.narrative-thread-filters__treeselect.m2p-narrative-treeselect--summary-trigger .treeselect-input__tags-element,
.narrative-thread-filters__treeselect.m2p-narrative-treeselect--summary-trigger .treeselect-input__tags-count {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.narrative-thread-filters__treeselect.m2p-narrative-treeselect--summary-trigger .treeselect-input[data-selection-summary]:not([data-selection-summary=""])::after {
    position: absolute;
    inset: 0 38px 0 12px;
    display: block;
    overflow: hidden;
    color: var(--shell-text);
    font-size: .82rem;
    line-height: 42px;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    content: attr(data-selection-summary);
}

.narrative-thread-filters__treeselect.m2p-narrative-treeselect--summary-trigger .treeselect-input[data-selection-summary]:not([data-selection-summary=""]) .treeselect-input__edit {
    color: transparent;
    caret-color: var(--shell-text);
}

.narrative-thread-filters__treeselect .treeselect-input {
    border-color: var(--shell-line);
    border-radius: var(--shell-radius-sm);
    background: var(--shell-control);
    color: var(--shell-text);
}

.narrative-thread-filters__treeselect .treeselect-input__edit {
    color: var(--shell-text);
    background: transparent;
}

.narrative-thread-filters__treeselect .treeselect-input__edit::placeholder,
.narrative-thread-filters__treeselect-state,
.narrative-thread-filters__error {
    color: var(--shell-text-soft);
}

.narrative-thread-filters__treeselect .treeselect-list {
    z-index: 1030;
}

.narrative-thread-filters__treeselect.m2p-narrative-treeselect--modal-filter .treeselect-list {
    width: min(460px, calc(100vw - 72px));
    min-width: min(420px, calc(100vw - 72px));
    max-width: min(560px, calc(100vw - 72px));
    max-height: min(420px, calc(100vh - 160px));
    overflow: auto;
}

.narrative-thread-filters__treeselect.m2p-narrative-treeselect--modal-filter .treeselect-list__item-label,
.narrative-thread-filters__treeselect.m2p-narrative-treeselect--modal-filter .treeselect-input__tags-name {
    min-width: 0;
    white-space: normal;
    line-height: 1.3;
}

.narrative-thread-filters__treeselect-state {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    font-size: .78rem;
}

.narrative-thread-filters__error {
    margin: 0;
    font-size: .74rem;
    line-height: 1.35;
}

.narrative-thread-modal__results {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    padding: 14px;
}

.narrative-thread-modal__results-header,
.narrative-thread-modal__selected-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.narrative-thread-modal__results-header span {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.narrative-thread-modal__results-header button {
    min-height: 26px;
    padding: 4px 9px;
    border: 1px solid color-mix(in srgb, var(--shell-accent) 42%, var(--shell-line));
    border-radius: 6px;
    color: var(--shell-accent-strong);
    background: color-mix(in srgb, var(--shell-accent) 10%, transparent);
    font: inherit;
    font-size: .74rem;
    font-weight: 650;
    cursor: pointer;
}

.narrative-thread-modal__results-header button:hover {
    border-color: var(--shell-accent);
    background: color-mix(in srgb, var(--shell-accent) 17%, transparent);
}

.narrative-thread-modal__results-header button.is-muted {
    border-color: var(--shell-line);
    color: var(--shell-text-soft);
    background: var(--shell-control);
}

.narrative-thread-modal__results-header button.is-muted:hover {
    color: var(--shell-text);
    border-color: var(--shell-line-strong);
    background: var(--surface_hover);
}

.narrative-thread-modal__result-list,
.narrative-thread-modal__selected-list {
    display: grid;
    align-content: start;
    gap: 8px;
    min-height: 0;
    overflow: auto;
}

.narrative-thread-result {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 56px;
    max-height: 64px;
    padding: 8px 10px;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius-sm);
    background: var(--shell-bg);
    cursor: pointer;
}

.narrative-thread-result:hover,
.narrative-thread-result.is-selected {
    border-color: var(--shell-accent);
    background: var(--shell-accent-soft);
}

.narrative-thread-result:focus-within {
    border-color: var(--shell-accent);
    box-shadow: 0 0 0 3px var(--shell-accent-soft);
}

.narrative-thread-result input {
    margin: 0;
}

.narrative-thread-result__dot,
.narrative-thread-selected > span {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--thread-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--thread-color) 18%, transparent);
}

.narrative-thread-result__content {
    display: grid;
    gap: 3px;
    min-width: 0;
    align-content: center;
}

.narrative-thread-result__content strong,
.narrative-thread-result__content small,
.narrative-thread-result__events,
.narrative-thread-selected small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.narrative-thread-result__content strong {
    color: var(--shell-text);
    font-size: .82rem;
    line-height: 1.2;
}

.narrative-thread-result__content small,
.narrative-thread-result__events {
    color: var(--shell-text-soft);
    font-size: .76rem;
    font-style: normal;
    line-height: 1.2;
}

.narrative-thread-result__events {
    align-self: start;
    max-width: 90px;
    padding-top: 1px;
    text-align: right;
}

.narrative-thread-selected {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius-sm);
    background: var(--shell-bg);
}

.narrative-thread-selected > span {
    margin-top: 0;
}

.narrative-thread-selected strong {
    color: var(--shell-text);
    font-size: .75rem;
}

.narrative-thread-selected button {
    display: inline-flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    color: var(--shell-text-soft);
    background: transparent;
}

.narrative-thread-modal__empty {
    padding: 24px;
    color: var(--shell-text-soft);
    text-align: center;
}

.narrative-thread-modal__footer {
    justify-content: flex-end;
    border-top: 1px solid var(--shell-line);
    border-bottom: 0;
}

.narrative-threads__list {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.narrative-threads__group {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.narrative-threads__group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.narrative-threads__group-header h3 {
    margin: 0;
    color: var(--shell-text);
    font-size: .86rem;
    letter-spacing: 0;
}

.narrative-threads__rows {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.narrative-thread-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 6px;
    align-items: stretch;
    min-width: 0;
}

.narrative-thread-row__column-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    cursor: pointer;
}

.narrative-thread-row__column-toggle input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--shell-accent);
    cursor: pointer;
}

.narrative-thread-row__main {
    display: grid;
    grid-template-columns: 26px 14px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius-sm);
    background: var(--shell-panel);
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.narrative-thread-row__main:hover,
.narrative-thread-row.is-selected .narrative-thread-row__main {
    border-color: var(--shell-accent);
    background: var(--shell-accent-soft);
}

.narrative-thread-row__icon {
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
}

.narrative-thread-row__icon img {
    max-width: 22px;
    max-height: 22px;
    object-fit: contain;
}

.narrative-thread-row__dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--thread-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--thread-color) 18%, transparent);
}

.narrative-thread-row__content {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.narrative-thread-row__content strong,
.narrative-thread-row__content small,
.narrative-thread-row__content span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.narrative-thread-row__content strong {
    color: var(--shell-text);
    font-size: .88rem;
}

.narrative-thread-row__content small,
.narrative-thread-row__content span,
.narrative-thread-row__meta {
    color: var(--shell-text-soft);
    font-size: .76rem;
}

.narrative-thread-row__meta {
    display: grid;
    justify-items: end;
    gap: 5px;
    white-space: nowrap;
}

.narrative-thread-status {
    padding: 2px 7px;
    border: 1px solid var(--shell-line);
    border-radius: 999px;
    background: var(--shell-bg-soft);
    color: var(--shell-text-soft);
}

.narrative-thread-status.is-active {
    border-color: color-mix(in srgb, var(--shell-success) 38%, transparent);
    background: color-mix(in srgb, var(--shell-success) 14%, transparent);
    color: var(--shell-success);
}

.narrative-thread-form__scope-picker {
    min-width: 0;
    min-height: 42px;
}

.narrative-thread-form__scope-picker .treeselect-input {
    min-height: 42px;
    border-color: var(--shell-line);
    border-radius: var(--shell-radius-sm);
    background: var(--shell-control);
    color: var(--shell-text);
}

.narrative-thread-form__scope-picker .treeselect-list {
    z-index: 1030;
}

.narrative-thread-form__color {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.narrative-thread-form__color input[type="color"] {
    min-height: 38px;
    padding: 3px;
}

.narrative-thread-form__color span {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--thread-color);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--thread-color) 18%, transparent);
}

.narrative-thread-linked-events h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.narrative-thread-linked-event {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 9px;
    border: 1px solid var(--shell-line);
    border-radius: var(--shell-radius-sm);
    background: var(--shell-bg);
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.narrative-thread-linked-event span {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.narrative-thread-linked-event strong,
.narrative-thread-linked-event small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.narrative-thread-linked-event strong {
    color: var(--shell-text);
    font-size: .8rem;
}

.narrative-thread-linked-event small,
.narrative-thread-linked-event i {
    color: var(--shell-text-soft);
}

@media (max-width: 980px) {
    .narrative-events__table {
        min-width: 680px;
    }

    .narrative-events__table .is-event {
        min-width: 260px;
    }

    .narrative-events__table .is-reference {
        width: 112px;
        min-width: 104px;
    }

    .narrative-events__table .is-notes {
        width: 48px;
        min-width: 46px;
    }

    .narrative-events__reference-stack {
        max-width: 112px;
    }

    .narrative-events__thread-focus {
        padding: 9px;
    }

    .narrative-thread-modal__body {
        grid-template-columns: minmax(0, 1fr);
        overflow: auto;
    }

    .narrative-thread-modal__filters,
    .narrative-thread-modal__selected {
        border: 0;
    }
}
