/* ==========================================
   INVESTIGATION BOARD - FINAL COMPLETE STYLES
   ========================================== */

* {
    box-sizing: border-box;
}

.investigation-board-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* --- HEADER & TABS INTEGRATION --- */
.investigation-header {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    padding: 0 20px;
    height: 64px;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    z-index: 100;
}

.header-main {
    display: flex;
    align-items: stretch;
    gap: 32px;
}

.investigation-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
}


.investigation-title i {
    color: var(--primary-color);
}

/* --- HEADER EXTRAS (PHASE & STATUS) --- */
.investigation-header-actions {
    display: flex;
    align-items: center;
    height: 100%;
}

.active-case-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    height: 40px;
    align-self: center;
}

.phase-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    border-right: 1px solid var(--border-color);
    padding-right: 12px;
}

.phase-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.phase-select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
    cursor: pointer;
    padding-right: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ff8c42' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
}

.phase-select:focus {
    outline: none;
}

.case-badge {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(var(--bg-tertiary-rgb), 0.5);
}

.case-badge.status-open {
    color: var(--accent-red);
    background: rgba(var(--accent-red-rgb), 0.1);
}

.case-badge.status-progress {
    color: var(--accent-gold);
    background: rgba(var(--accent-gold-rgb), 0.1);
}

.case-badge.status-solved {
    color: var(--accent-green);
    background: rgba(var(--accent-green-rgb), 0.1);
}

.case-badge.status-closed {
    color: var(--text-muted);
    background: var(--bg-tertiary);
}

.case-tabs {

    display: flex;
    gap: 4px;
    align-items: flex-end;
}

.case-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: 42px;
    background: rgba(var(--bg-tertiary-rgb), 0.4);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.2s;
    position: relative;
    top: 2px;
    margin-right: 2px;
}

.case-tab:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.case-tab.active {
    background: var(--bg-primary);
    color: var(--primary-color) !important;
    border: 2px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-bottom: 3px solid var(--bg-primary);
    z-index: 10;
    height: 44px;
}

.case-tab-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.case-tab-indicator.status-open {
    background: var(--accent-red);
}

.case-tab-indicator.status-progress {
    background: var(--accent-gold);
}

.case-tab-indicator.status-solved {
    background: var(--accent-green);
}

.case-tab-add {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0 12px;
    height: 100%;
    display: flex;
    align-items: center;
    opacity: 0.6;
}

.case-tab-add:hover {
    opacity: 1;
    color: var(--primary-color);
}

/* --- TOOLBAR (SECOND NAV) --- */
.investigation-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    height: 56px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
}

.investigation-nav {
    display: flex;
    height: 100%;
}

.investigation-nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 24px;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    border-bottom: 4px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.investigation-nav-btn:hover {
    background: rgba(var(--primary-color-rgb), 0.04);
    color: var(--text-primary);
}

.investigation-nav-btn.active {
    color: var(--primary-color) !important;
    border-bottom-color: var(--primary-color);
    background: linear-gradient(to top, rgba(var(--primary-color-rgb), 0.08), transparent);
}

/* --- VIEW CONTAINERS --- */
.investigation-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: var(--bg-primary);
}

.investigation-dashboard,
.investigation-registry,
.investigation-matrix,
.investigation-mmo,
.investigation-timeline {
    height: 100%;
    overflow-y: auto;
    padding: 24px;
}


/* --- DASHBOARD & SIDEBAR --- */
.investigation-dashboard.has-overview {
    display: flex;
    height: 100%;
    padding: 0;
}

.case-overview {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* Using global sidebar class for consistency */
.sidebar {
    width: 360px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 5px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.case-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.case-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.case-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.case-icon-wrapper {
    margin-bottom: 12px;
}

.case-status-ring {
    width: 44px;
    height: 44px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.case-icon {
    position: absolute;
    color: var(--primary-color);
}

.ring-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 3;
    opacity: 0.2;
}

.ring-fill {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 3;
    stroke-linecap: round;
}

.mini-avatar,
.mini-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-weight: 800;
    border: 1px solid var(--border-color);
}

/* --- STATS & OVERVIEW INTERNAL --- */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.overview-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.stat-main {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--text-primary);
}

.overview-label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: block;
}

.overview-title-group h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
}

.overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

/* --- REGISTRY (RESTORATION) --- */
.registry-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.registry-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.fact-card {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all 0.2s;
    cursor: pointer;
    overflow: hidden;
}

.fact-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary-color);
}

.fact-type-icon {
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--primary-color-rgb), 0.05);
    border-right: 1px solid var(--border-color);
}

.fact-content {
    flex: 1;
    padding: 16px;
}

.fact-label {
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 4px;
    display: block;
}

.fact-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* --- CRIME WEB TIMELINE (NEW) --- */
.web-timeline-controls {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.web-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.web-timeline-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: var(--text-primary);
}

.scene-context .dim {
    color: var(--text-tertiary);
    font-weight: 500;
}

.web-timeline-slider-container {
    position: relative;
    padding: 24px 10px 10px 10px;
    /* Added top padding for labels */
    height: 60px;
    /* Increased height for labels */
}

.web-timeline-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
    z-index: 10;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
    cursor: grab;
}

.web-timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid var(--bg-secondary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    cursor: grab;
    transition: transform 0.1s;
    position: relative;
    z-index: 20;
}

.web-timeline-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}


.web-timeline-markers {
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    height: 10px;
    transform: translateY(-50%);
    z-index: 1;
    pointer-events: none;
}


/* Marker Styles */
.marker {
    position: absolute;
    width: 2px;
    height: 6px;
    background: rgba(0, 0, 0, 0.2);
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    /* Allow hover */
    transition: height 0.2s, background 0.2s;
}

.marker:hover {
    height: 12px;
    background: var(--primary-color);
}

.marker-chapter {
    position: absolute;
    width: 2px;
    height: 12px;
    background: var(--border-color);
    /* Darker than scene tick */
    top: 50%;
    transform: translate(-50%, -50%);
}

.marker-act {
    position: absolute;
    width: 2px;
    height: 18px;
    /* Tallest */
    background: var(--text-primary);
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.timeline-act-label {
    position: absolute;
    top: -28px;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--text-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    pointer-events: none;
}

.web-timeline-markers .marker.start-marker {
    display: none;
    /* Removed start marker as it's redundant/confusing with new logic */
}

/* Remove old class styles just in case */
.timeline-chapter-label {
    display: none;
}

.web-timeline-markers .marker {
    display: block;
}

/* Ensure basic marker is blocked */

.web-context-badge {
    display: none;
    /* Removed as it's now in the header */
}

/* --- SUSPECT GRID (NEW) --- */
.web-grid-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    background: var(--bg-tertiary);
    overflow-y: auto;
}

.web-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding-top: 20px;
}

.suspect-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.suspect-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.suspect-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.suspect-avatar-small {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.suspect-identity {
    flex: 1;
}

.suspect-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.suspect-role {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.suspect-score-badge {
    background: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

/* MMO Bars inside Card */
.suspect-mmo-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mmo-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
}

.mmo-label {
    width: 70px;
    color: var(--text-secondary);
    font-weight: 600;
}

.mmo-progress-track {
    flex: 1;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.mmo-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.mmo-progress-fill.motive {
    background: var(--accent-red);
}

.mmo-progress-fill.means {
    background: var(--accent-gold);
}

.mmo-progress-fill.opportunity {
    background: var(--accent-green);
}

.mmo-value {
    width: 30px;
    text-align: right;
    font-family: monospace;
    font-weight: 700;
    color: var(--text-primary);
}

/* OLD CANVAS (HIDDEN) */
.web-canvas-container {
    display: none;

    width: 100%;
    height: 100%;
    min-height: 500px;
    background: radial-gradient(circle at center, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    cursor: grab;
    position: relative;
    overflow: hidden;
    /* Ensure nodes dont spill out */
}

.web-node {
    position: absolute;
    width: 60px;
    /* Slightly larger */
    height: 60px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    /* Allow name below */
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.web-node .suspect-avatar {
    margin-bottom: 2px;
}

.web-node .suspect-name {
    font-size: 0.75rem;
    text-align: center;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: absolute;
    bottom: -20px;
    background: var(--bg-secondary);
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.center-node {
    width: 80px;
    height: 80px;
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: bold;
    z-index: 20;
    /* Above suspects */
}

/* --- MATRIX (ENHANCED) --- */
.investigation-matrix {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.matrix-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    gap: 20px;
    /* Added gap to separate groups */
}

.matrix-title-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.matrix-actions-group {
    display: flex;
    align-items: center;
    border-left: 1px solid var(--border-color);
    padding-left: 20px;
    margin-right: auto;
    /* Push legend to right */
}



.matrix-label {
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.8rem;
}

.enhanced-select-wrapper {
    position: relative;
    min-width: 250px;
}

.enhanced-select {
    width: 100%;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 700;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.matrix-legend {
    display: flex;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.legend-item .matrix-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

.legend-item .matrix-icon.state-knows {
    color: var(--accent-green);
}

.legend-item .matrix-icon.state-suspicious {
    color: var(--accent-gold);
}

.legend-item .matrix-icon.state-misled {
    color: var(--accent-red);
}

.legend-item .matrix-icon.state-ignorant {
    color: var(--text-muted);
    opacity: 0.3;
}

/* Grid & Scroll */
.matrix-grid-outer {
    flex: 1;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
}

.matrix-grid-wrapper {
    width: 100%;
    height: 100%;
    overflow: auto;
    position: relative;
}

.matrix-table {
    width: max-content;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

/* Headers */
.matrix-table thead tr {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg-primary);
}

.matrix-table th {
    background: var(--bg-tertiary);
    /* Darker header */
    padding: 12px 8px;
    font-weight: 700;
    font-size: 0.8rem;
    border-bottom: 2px solid var(--border-color);
    /* Stronger separator */
    border-right: 1px solid var(--border-color);
    vertical-align: bottom;
    height: 140px;
    /* Tall header for rotated text */
    position: relative;
}

/* Corner sticky */
.matrix-table th.th-sticky-corner {
    position: sticky;
    left: 0;
    z-index: 40;
    width: 250px;
    min-width: 250px;
    background: var(--bg-secondary);
    border-right: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    text-align: left;
    padding: 16px;
    height: auto;
    vertical-align: bottom;
}

.sticky-col {
    position: sticky;
    left: 0;
    z-index: 20;
    background: var(--bg-primary);
    border-right: 2px solid var(--border-color) !important;
    width: 250px;
    min-width: 250px;
    max-width: 250px;
}

/* Rotated headers */
.th-scene-title {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
    text-align: left;
    width: 44px;
    /* Increased width for better spacing */
    height: 180px;
    /* Fixed height for vertical labels */
    max-height: 180px;
    overflow: hidden;
    margin: 0 auto;
    cursor: default;
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

.matrix-act-name {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 4px;
    opacity: 0.8;
}

.matrix-chap-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.matrix-scene-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Rows & Cells */
.matrix-table tbody tr:hover td {
    background: rgba(var(--primary-color-rgb), 0.03);
}

.td-character-name {
    border-bottom: 1px solid var(--border-color);
    padding: 8px 16px;
    font-weight: 600;
}

/* Ensure sticky column background covers row hover */
.matrix-table tbody tr:hover .td-character-name {
    background: var(--bg-secondary);
}

.char-cell-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.td-matrix-cell {
    width: 50px;
    /* Sightly wider for visibility */
    min-width: 50px;
    height: 40px;
    padding: 0;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    cursor: default;
    transition: all 0.1s;
}

.td-matrix-cell:hover {
    background: rgba(var(--primary-color-rgb), 0.1) !important;
}

.cell-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.matrix-icon {
    width: 20px;
    height: 20px;
    stroke-width: 3;
}

/* STATES COLORS */
.td-matrix-cell.state-knows {
    background: rgba(var(--accent-green-rgb), 0.1);
}

.td-matrix-cell.state-knows .matrix-icon {
    color: var(--accent-green);
}

.td-matrix-cell.state-suspicious {
    background: rgba(var(--accent-gold-rgb), 0.1);
}

.td-matrix-cell.state-suspicious .matrix-icon {
    color: var(--accent-gold);
}

.td-matrix-cell.state-misled {
    background: rgba(var(--accent-red-rgb), 0.1);
}

.td-matrix-cell.state-misled .matrix-icon {
    color: var(--accent-red);
}

.td-matrix-cell.state-ignorant .cell-marker {
    opacity: 0.1;
}

.td-matrix-cell.state-ignorant:hover .cell-marker::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
}

/* --- TIMELINE (RESTORATION) --- */
.timeline-path {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding-left: 50px;
}

.scene-node-marker {
    position: absolute;
    left: 11px;
    top: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 4px solid var(--bg-primary);
    z-index: 5;
}

.scene-node-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 32px;
}

.timeline-fact-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-primary);
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
}

/* --- MODALS & FORMS (RESTORATION) --- */

/* .modal-overlay : overlay de fond utilisé par les modales du tableau d'enquête
   (investigation-board.dashboard.js et investigation-board.registry.js)
   NOTE : la classe globale dans modals.css s'appelle .modal — ici on définit
   l'alias .modal-overlay qui manquait, ce qui causait le fond transparent. */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* .modal-container : container interne de la modale (équivalent de .modal-content) */
.modal-container {
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-container.large-modal {
    max-width: 820px;
}

/* Taille "medium" utilisée par la modale de création/édition d'affaire */
.modal-content.modal-medium {
    max-width: 640px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
}

.modal-tabs {
    display: flex;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}


.btn-text {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
}

.btn-text:hover {
    text-decoration: underline;
}

.chars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.char-select-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.char-select-item:hover {
    border-color: var(--primary-color);
}

.char-select-item.selected {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.1);
    box-shadow: 0 0 0 1px var(--primary-color);
}

/* --- EMPTY STATES --- */
.empty-state-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    margin: 60px auto;
}

/* --- STEPPER --- */
.progress-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.stepper-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.4;
    width: 100px;
}

.stepper-step.active,
.stepper-step.completed {
    opacity: 1;
}

.stepper-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.stepper-step.active .stepper-icon {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.stepper-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
}

.stepper-step.active .stepper-label {
    color: var(--primary-color);
}

.stepper-line {
    width: 30px;
    height: 1px;
    background: var(--border-color);
    margin: 0 10px 18px 10px;
}

/* --- LUCIDE & UTILS --- */
[data-lucide] {
    stroke-width: 2.5px;
    width: 1.2em;
    height: 1.2em;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn:hover {
    filter: brightness(1.1);
}

.status-open {
    color: var(--accent-red);
}

.status-progress {
    color: var(--accent-gold);
}

.status-solved {
    color: var(--accent-green);
}



/* --- MODAL TABS (Added by Restoration) --- */
.modal-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
    padding: 0 24px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- TIMELINE EVOLUTION STYLES --- */
.evolution-timeline {
    position: relative;
    padding-left: 20px;
    margin-top: 15px;
    border-left: 2px solid var(--border-color);
}

.evo-step {
    position: relative;
    margin-bottom: 20px;
    padding-left: 20px;
}

.evo-marker {
    position: absolute;
    left: -29px;
    /* Adjust based on circle size */
    top: 15px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 3px solid var(--primary-color);
    z-index: 2;
}

.evo-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.evo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.evo-scene {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

.status-pill {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-pill.status-revealed {
    background: #dcfce7;
    color: #166534;
}

.status-pill.status-hinted {
    background: #fef9c3;
    color: #854d0e;
}

.status-pill.status-obscured {
    background: #f1f5f9;
    color: #475569;
}

.status-pill.status-disputed {
    background: #fee2e2;
    color: #991b1b;
}

.status-pill.status-confirmed {
    background: #dbeafe;
    color: #1e40af;
}

.evo-body {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.evo-actor {
    margin-bottom: 4px;
    font-style: italic;
    color: var(--text-primary);
}

.evo-desc {
    line-height: 1.4;
}

.evo-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.evo-card:hover .evo-actions {
    opacity: 1;
}

/* Timeline Editor Overlay */
.timeline-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    /* Above regular modal */
}

.timeline-editor-card {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: 12px;
    width: 450px;
    max-width: 90%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-editor-card h4 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
}

.timeline-editor-card .form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}


/* --- MATRIX DETAILED MODE --- */
.mode-detailed .row-character-header td {
    background-color: var(--bg-tertiary) !important;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    padding: 12px 16px;
    z-index: 25;
}

.mode-detailed .row-fact-detail td {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    opacity: 0.8;
}

.mode-detailed .td-fact-label {
    padding-left: 40px !important;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-right: 2px solid var(--border-color) !important;
    font-style: italic;
}

.fact-sublabel {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.mode-detailed .row-character-header .mini-avatar {
    width: 22px;
    height: 22px;
    font-size: 11px;
}

.mode-detailed .row-fact-detail:hover td {
    background: rgba(var(--primary-color-rgb), 0.02);
}


/* --- DASHBOARD --- */
.investigation-dashboard {
    padding: 32px;
    height: 100%;
    overflow-y: auto;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.case-overview {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Overview Header */
.overview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.overview-title-group h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 8px 0 0 0;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.overview-label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary-color);
    letter-spacing: 0.1em;
}

.overview-actions {
    display: flex;
    gap: 12px;
}

/* Overview Grid & Cards */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.overview-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.overview-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
    border-color: var(--primary-color);
}

.overview-card .card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-main {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-sub {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Suspects in Grid */
.suspects-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.suspect-mini-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 6px 12px 6px 6px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
}

.suspect-mini-profile .mini-avatar {
    width: 26px;
    height: 26px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
}

.more-count {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
}

/* Recent Discoveries Section */
.overview-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.overview-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    border: none;
}

.overview-section h4 {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0;
}

.recent-facts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.recent-fact-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 12px;
    transition: all 0.2s;
}

.recent-fact-item:hover {
    background: white;
    border-color: var(--primary-color);
    transform: scale(1.02);
}

.recent-fact-item i {
    color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.1);
    padding: 8px;
    border-radius: 8px;
    width: 32px;
    height: 32px;
}

.recent-fact-item span {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Dashboard Footer */
.overview-footer {
    display: flex;
    justify-content: center;
    padding-top: 16px;
}

.overview-footer .btn-lg {
    max-width: 400px;
    height: 56px;
    font-size: 1.1rem;
    box-shadow: 0 8px 24px rgba(var(--primary-color-rgb), 0.25);
}


/* --- DASHBOARD GRID & EMPTY STATE --- */
.dashboard-empty-state {
    max-width: 700px;
    margin: 60px auto;
    text-align: center;
    padding: 40px;
}

.empty-state-icon {
    margin-bottom: 24px;
    color: var(--primary-color);
    opacity: 0.2;
}

.empty-state-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.6;
}

.onboarding-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 48px;
    text-align: left;
}

.onboarding-step {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
}

.step-content strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 4px;
}

.step-content span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Cases Grid */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.dashboard-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.case-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.case-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.case-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.case-icon-wrapper {
    position: relative;
    width: 44px;
    height: 44px;
}

.case-status-ring svg {
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 3;
}

.ring-fill {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

.case-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary-color);
}

.case-status-badge {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.case-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 8px 0 0 0;
}

.case-phase-tag {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}

.case-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.case-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.case-stats span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.case-actions {
    position: absolute;
    top: 24px;
    right: 24px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.case-card:hover .case-actions {
    opacity: 1;
}

/* --- PREMIUM SIDEBAR --- */
.investigation-sidebar-active {
    background-color: var(--bg-secondary) !important;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.investigation-sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: var(--text-primary);
}

.sidebar-search-container {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-color);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 10px;
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.search-input-wrapper input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

.search-input-wrapper input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.sidebar-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.count-badge {
    background: var(--border-color);
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.btn-add-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-add-circle:hover {
    transform: scale(1.1);
    background: var(--primary-hover);
}

.btn-add-circle i {
    width: 14px;
    height: 14px;
}

.sidebar-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 16px 8px;
}

.case-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.case-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.case-item:hover {
    background: rgba(var(--primary-color-rgb), 0.05);
}

.case-item.active {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-color: var(--border-color);
}

.case-icon-box {
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}

.case-item.active .case-icon-box {
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
}

.case-icon-box i {
    width: 16px;
    height: 16px;
}

.case-info {
    flex: 1;
    overflow: hidden;
}

.case-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.case-item-meta {
    display: flex;
    align-items: center;
}

.case-status-pill {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.case-status-pill.status-open {
    background: #e0f2f1;
    color: #00695c;
}

.case-status-pill.status-in_progress {
    background: #fff3e0;
    color: #ef6c00;
}

.case-status-pill.status-solved {
    background: #e8f5e9;
    color: #2e7d32;
}

.case-status-pill.status-closed {
    background: #f5f5f5;
    color: #616161;
}

.active-indicator {
    width: 4px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 2px;
    position: absolute;
    left: 0;
}



.empty-nav-item {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ==========================================
   INVESTIGATION TIMELINE - PREMIUM UI
   ========================================== */

.investigation-timeline {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    animation: fadeIn 0.5s ease;
}

.timeline-header {
    text-align: center;
    margin-bottom: 60px;
}

.timeline-header h3 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.timeline-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.timeline-path {
    position: relative;
    padding-left: 60px;
}

.timeline-vertical-line {
    position: absolute;
    left: 19px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom,
            rgba(var(--primary-color-rgb), 0.5) 0%,
            var(--primary-color) 15%,
            var(--primary-color) 85%,
            rgba(var(--primary-color-rgb), 0.1) 100%);
    box-shadow: 0 0 10px rgba(var(--primary-color-rgb), 0.2);
}

.timeline-scene-node {
    position: relative;
    margin-bottom: 48px;
    opacity: 0;
    transform: translateY(20px);
    animation: slideUpFade 0.6s forwards;
}

@keyframes slideUpFade {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scene-node-marker {
    position: absolute;
    left: -60px;
    top: 24px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 4px solid var(--bg-primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-color-rgb), 0.1);
    z-index: 10;
}

.timeline-scene-node:hover .scene-node-marker {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(var(--primary-color-rgb), 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scene-node-content {
    background: rgba(var(--bg-secondary-rgb), 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--border-color-rgb), 0.5);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

.timeline-scene-node:hover .scene-node-content {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    transform: translateX(5px);
}

.scene-node-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.scene-node-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.scene-node-breadcrumb [data-lucide="chevron-right"] {
    width: 12px;
    height: 12px;
    opacity: 0.5;
}

.breadcrumb-item.scene {
    color: var(--primary-color);
}

.scene-node-steps {
    display: grid;
    gap: 16px;
}

.timeline-step-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.timeline-step-card:hover {
    border-color: var(--primary-color);
    background: white;
    transform: scale(1.02);
}

.step-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.step-fact-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.step-fact-info i {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--primary-color-rgb), 0.08);
    color: var(--primary-color);
    border-radius: 10px;
    font-size: 1.1rem;
}

.step-fact-info strong {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.status-pill {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.05em;
}

.status-pill.status-revealed {
    background: #dcfce7;
    color: #15803d;
}

.status-pill.status-hinted {
    background: #fef9c3;
    color: #a16207;
}

.status-pill.status-obscured {
    background: #f1f5f9;
    color: #475569;
}

.step-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step-actor {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.step-actor strong {
    color: var(--text-primary);
}

.step-desc {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-primary);
    font-style: italic;
}

.step-card-actions {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.2s;
}

.timeline-step-card:hover .step-card-actions {
    opacity: 1;
    transform: translateX(0);
}

/* Empty State */

.empty-timeline {
    text-align: center;
    padding: 60px;
    background: var(--bg-secondary);
    border-radius: 32px;
    border: 2px dashed var(--border-color);
}

.empty-timeline i {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    opacity: 0.2;
    margin-bottom: 24px;
}

.empty-timeline p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* ==========================================
   INVESTIGATION REGISTRY - PREMIUM UI
   ========================================== */

.investigation-registry {
    padding: 32px;
    height: 100%;
    background: var(--bg-primary);
}

.registry-header-premium {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.header-left h3 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.header-left p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.registry-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
}

.registry-search {
    display: flex;
    align-items: center;
    width: 400px;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0 16px;
    gap: 12px;
    transition: all 0.2s;
}

.registry-search i {
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    pointer-events: none;
}

.registry-search input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-primary);
    outline: none;
    height: 100%;
}

.registry-search:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(var(--primary-color-rgb), 0.1);
}


.btn-registry-filter {
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
}

/* List Layout */
.registry-list-premium.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 24px;
}

.registry-list-premium.mode-table {
    display: block;
    width: 100%;
    overflow-x: auto;
}

.fact-card-premium {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    min-height: 180px;
}

.fact-card-premium:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.card-left-bar {
    width: 6px;
    height: 100%;
    flex-shrink: 0;
}

.card-left-bar.status-verified {
    background: var(--accent-green);
}

.card-left-bar.status-doubtful {
    background: var(--accent-gold);
}

.card-left-bar.status-false {
    background: var(--accent-red);
}

.card-icon-area {
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 24px;
    background: rgba(var(--bg-tertiary-rgb), 0.3);
    border-right: 1px solid var(--border-color);
    position: relative;
}

.icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 12px;
}



.card-main-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.card-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.fact-type-badge {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
}

.fact-status-pill {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
}

.fact-status-pill.status-verified {
    background: #dcfce7;
    color: #166534;
}

.fact-status-pill.status-doubtful {
    background: #fef9c3;
    color: #854d0e;
}

.fact-status-pill.status-false {
    background: #fee2e2;
    color: #991b1b;
}

.fact-title-premium {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0 0 8px 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.secret-icon-mini {
    color: var(--accent-red);
    width: 14px;
    height: 14px;
}

.fact-desc-premium {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer-registry {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid rgba(var(--border-color-rgb), 0.5);
}

.mini-avatar-stack {
    display: flex;
    align-items: center;
}

.mini-avatar-registry {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    margin-left: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 0.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mini-avatar-registry:first-child {
    margin-left: 0;
}

.mini-avatar-more {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 800;
    margin-left: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-secondary);
}

.no-links-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.card-meta-indicators {
    display: flex;
    gap: 12px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 700;
}

.meta-item i {
    width: 14px;
    height: 14px;
}

/* Search Focus Highlight */
.fact-card-premium:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(var(--primary-color-rgb), 0.1);
}

/* Modal specific adjustments */
.premium-modal-timeline {
    padding: 20px 0;
}

.premium-modal-timeline .timeline-path {
    padding-left: 40px;
}

.premium-modal-timeline .timeline-vertical-line {
    left: 9px;
}

.premium-modal-timeline .scene-node-marker {
    left: -40px;
    width: 16px;
    height: 16px;
    top: 20px;
}

.premium-modal-timeline .scene-node-content {
    padding: 16px;
}

.premium-modal-timeline .scene-node-breadcrumb {
    font-size: 0.7rem;
}

/* --- REGISTRY DISPLAY TOGGLE --- */
.registry-display-toggle {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 2px;
    border-radius: 10px;
}

.registry-display-toggle .toggle-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.registry-display-toggle .toggle-btn:hover {
    color: var(--text-primary);
}

.registry-display-toggle .toggle-btn.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.registry-display-toggle .toggle-btn i {
    width: 18px;
    height: 18px;
}

/* --- REGISTRY TABLE PREMIUM --- */
.registry-table-container {
    width: 100%;
    background: var(--bg-primary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-top: 10px;
}

.registry-table-premium {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.registry-table-premium thead {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
}

.registry-table-premium th {
    padding: 18px 24px;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    white-space: nowrap;
}

.col-item {
    width: 35%;
}

.col-type {
    width: 10%;
}

.col-status {
    width: 10%;
}

.col-secret {
    width: 5%;
    text-align: center !important;
}

.col-location {
    width: 15%;
}

.col-chars {
    width: 15%;
}

.col-evolution {
    width: 5%;
}

.col-actions {
    width: 5%;
}

.registry-row {
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.registry-row:last-child {
    border-bottom: none;
}

.registry-row:hover {
    background: rgba(var(--primary-color-rgb), 0.03);
}

.registry-table-premium td {
    padding: 16px 20px;
    vertical-align: middle;
}

/* Column Item */
.item-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.item-icon-mini {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    flex-shrink: 0;
}

.item-icon-mini i {
    width: 18px;
    height: 18px;
}

.item-info {
    display: flex;
    flex-direction: column;
}

.item-label {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.item-desc-compact {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Type Pill Compact */
.type-pill-compact {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

/* Status Pill Compact */
.status-pill-compact {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

.status-pill-compact.status-verified {
    background: rgba(var(--success-color-rgb), 0.1);
    color: var(--success-color);
}

.status-pill-compact.status-disputed {
    background: rgba(var(--warning-color-rgb), 0.1);
    color: var(--warning-color);
}

.status-pill-compact.status-false {
    background: rgba(var(--danger-color-rgb), 0.1);
    color: var(--danger-color);
}

/* Evolution Cell */
.location-cell-table {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.location-cell-table i {
    width: 14px;
    height: 14px;
    color: var(--primary-color);
}

.evolution-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    width: fit-content;
}

.evolution-cell i {
    width: 14px;
    height: 14px;
}

.evolution-count {
    font-size: 0.8rem;
    font-weight: 800;
}

.no-evolution-hint,
.no-chars-hint {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Row Actions */
.row-actions {
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 0.2s;
}

.registry-row:hover .row-actions {
    opacity: 1;
}

.btn-row-action {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-row-action:hover {
    background: var(--danger-color);
    color: white;
}

.btn-row-action i {
    width: 16px;
    height: 16px;
}

/* --- TABLE COLUMN FILTERS --- */
.table-filter-row {
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-color);
}

.table-filter-row th {
    padding: 8px 12px !important;
}

.col-filter-input {
    display: flex;
    align-items: center;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 10px;
    gap: 8px;
    height: 36px;
}

.col-filter-input i {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.col-filter-input input {
    background: transparent;
    border: none;
    font-size: 0.85rem;
    color: var(--text-primary);
    width: 100%;
    outline: none;
}

.col-filter-select {
    width: 100%;
    height: 36px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 8px;
    font-size: 0.85rem;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
}

.col-filter-select:focus,
.col-filter-input:focus-within {
    border-color: var(--primary-color);
}

/* --- EMPTY TABLE ROW --- */
.table-empty-row {
    text-align: center;
    padding: 60px !important;
    color: var(--text-muted);
}

.table-empty-row i {
    width: 48px;
    height: 48px;
    opacity: 0.3;
    margin-bottom: 12px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.table-empty-row span {
    display: block;
    font-size: 1rem;
    margin-bottom: 16px;
}

.btn-text-action {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-text-action:hover {
    background: rgba(var(--primary-color-rgb), 0.1);
}

/* --- CHARACTER TAGS TABLE --- */
.chars-list-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 250px;
}

.char-tag-table {
    display: inline-flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--char-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

/* ==========================================
   ANALYSIS PIVOT (NEW CRIME WEB)
   ========================================== */

.investigation-analysis-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--bg-tertiary);
}

/* --- TOOLBAR --- */
.analysis-toolbar {
    display: flex;
    flex-direction: column;
    /* Stack selector and timeline */
    align-items: stretch;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 10;
    gap: 16px;
}

.analysis-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.analysis-selector-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.analysis-selector-group label {
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.select-wrapper i {
    position: absolute;
    left: 10px;
    width: 16px;
    height: 16px;
    color: var(--primary-color);
    pointer-events: none;
}

#analysisIncidentSelect {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px 8px 36px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 250px;
    cursor: pointer;
    transition: all 0.2s;
}

#analysisIncidentSelect:hover {
    border-color: var(--primary-color);
}

#analysisIncidentSelect:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

/* --- DETAILED VISUAL TIMELINE --- */
.analysis-timeline-container {
    margin-top: 16px;
    width: 100%;
}

.timeline-meta-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.tm-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.tm-value {
    font-weight: 800;
    color: var(--primary-color);
}

.tm-context {
    font-style: italic;
    opacity: 0.8;
    font-size: 0.85rem;
}

/* Track Structure */
.visual-timeline-track {
    width: 100%;
}

.timeline-acts-container {
    display: flex;
    gap: 4px;
    /* Gap between Acts */
    width: 100%;
}

/* Act Block */
.timeline-act-block {
    display: flex;
    flex-direction: column;
    flex: 1;
    /* Acts share width equally or based on content? simple flex:1 for now */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-primary);
}

.act-label {
    background: var(--bg-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 800;
    text-align: center;
    padding: 2px 0;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

/* Chapters Row */
.act-chapters-row {
    display: flex;
    flex: 1;
    height: 24px;
    /* Height of the clickable track area */
}

.timeline-chapter-block {
    display: flex;
    flex: 1;
    border-right: 1px dashed var(--border-color);
    /* Subtle divider between chapters */
}

.timeline-chapter-block:last-child {
    border-right: none;
}

.chapter-scenes-row {
    display: flex;
    width: 100%;
    align-items: center;
    padding: 0 2px;
    gap: 1px;
    /* Tiny gap between scenes */
}

/* Scene Node */
.ts-node {
    flex: 1;
    height: 12px;
    background: var(--bg-tertiary);
    /* Future scenes */
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    min-width: 4px;
}

.ts-node:hover {
    transform: scaleY(1.3);
    background: var(--text-muted);
}

.ts-node.active {
    background: var(--text-secondary);
    /* Past scenes */
}

.ts-node.current {
    background: var(--primary-color);
    /* Current scene */
    transform: scaleY(1.4);
    box-shadow: 0 0 4px rgba(var(--primary-color-rgb), 0.4);
    z-index: 2;
}

/* --- ANALYSIS CONTENT --- */
.analysis-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.analysis-table-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.analysis-table {
    width: 100%;
    border-collapse: collapse;
}

.analysis-table thead {
    background: var(--bg-primary);
    border-bottom: 2px solid var(--border-color);
}

.analysis-table th {
    padding: 16px 20px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.analysis-table td {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.analysis-row {
    cursor: pointer;
    transition: background 0.1s;
}

.analysis-row:hover {
    background: rgba(var(--primary-color-rgb), 0.03);
}

.analysis-row:last-child td {
    border-bottom: none;
}

/* Column Widths */
.th-suspect {
    width: 25%;
}

.th-mmo {
    width: 20%;
}

.th-score {
    width: 10%;
    text-align: center !important;
}

.th-action {
    width: 5%;
}

/* Cells */
.suspect-cell-compact {
    display: flex;
    align-items: center;
    gap: 12px;
}

.suspect-avatar-micro {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 0.9rem;
    background: var(--text-muted);
    /* Fallback */
}

.suspect-name-table {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* MMO Compact Bars */
.mmo-bar-compact {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mmo-track {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    min-width: 60px;
}

.mmo-fill {
    height: 100%;
    border-radius: 3px;
}

.mmo-fill.motive {
    background: var(--accent-red);
}

.mmo-fill.means {
    background: var(--accent-gold);
}

.mmo-fill.opportunity {
    background: var(--accent-green);
}

.mmo-val {
    font-weight: 700;
    font-family: monospace;
    width: 20px;
    text-align: right;
    color: var(--text-secondary);
}

/* Score Badge */
.td-score {
    text-align: center !important;
}

.score-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.9rem;
    min-width: 48px;
}

.score-badge.low {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.score-badge.medium {
    background: rgba(var(--accent-gold-rgb), 0.1);
    color: var(--accent-gold);
}

.score-badge.high {
    background: rgba(var(--accent-red-rgb), 0.15);
    color: var(--accent-red);
    box-shadow: 0 0 0 2px rgba(var(--accent-red-rgb), 0.1);
}

/* Actions */
.btn-icon-sm {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.analysis-row:hover .btn-icon-sm {
    background: var(--bg-primary);
    color: var(--primary-color);
}

.btn-icon-sm i {
    width: 14px;
    height: 14px;
}

/* --- NESTED ROWS (GLOBAL VIEW) --- */
.suspect-header-row td {
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-color);
    padding: 8px 16px;
}

.suspect-header-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.suspect-name-header {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-primary);
}

.nested-row {
    background: var(--bg-primary);
    /* Lighter than header */
}

.nested-row:hover {
    background: var(--bg-secondary);
}

.nested-row td {
    border-bottom: 1px dashed var(--border-color);
}

.nested-incident-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 32px;
    /* Indent */
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}

.nested-incident-label i {
    width: 14px;
    height: 14px;
    opacity: 0.5;
}

/* Filter Group */
.analysis-filter-group {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.checkbox-label:hover {
    background: var(--bg-tertiary);
}

.checkbox-label input {
    cursor: pointer;
}

/* MMO Details */
.mmo-detail-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.2;
    padding-left: 2px;
    border-left: 2px solid var(--border-color);
    padding-left: 6px;
    font-style: italic;
    max-width: 250px;
    /* Prevent overflow */
    white-space: normal;
    /* Ensure text wrapping */
}

/* Inherited State */
.mmo-fill.inherited {
    opacity: 0.4;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255, 255, 255, 0.3) 5px, rgba(255, 255, 255, 0.3) 10px);
}

.inherited-icon {
    width: 12px;
    height: 12px;
    color: var(--text-muted);
    margin-left: -5px;
    /* Pull closer to val */
    opacity: 0.6;
}

/* --- TOGGLE SWITCHES (Premium Style) --- */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    vertical-align: middle;
    position: relative;
    padding: 2px;
    border-radius: 24px;
    transition: all 0.2s;
}

.toggle-switch:hover {
    background: rgba(var(--primary-color-rgb), 0.05);
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    margin: 0;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 26px;
    background-color: var(--bg-tertiary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 26px;
    border: 1.5px solid var(--border-color);
    flex-shrink: 0;
    box-sizing: border-box;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    top: 2.5px;
    background-color: var(--text-muted);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(var(--primary-color-rgb), 0.3);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(21px);
    background-color: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.toggle-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.3px;
    transition: color 0.2s;
}

.toggle-switch:hover .toggle-label {
    color: var(--text-primary);
}

.toggle-switch input:checked~.toggle-label {
    color: var(--primary-color);
}

/* --- HELP SYSTEM --- */
.help-trigger {
    margin-left: 8px;
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.2s;
    cursor: help;
    display: inline-flex;
    align-items: center;
}

.help-trigger:hover {
    opacity: 1;
    transform: scale(1.1);
}

.help-trigger svg {
    width: 14px;
    height: 14px;
}

.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.help-modal {
    background: var(--bg-primary);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.3s ease;
}

.help-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.help-modal-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    color: var(--accent-color);
}

.help-modal-body {
    padding: 24px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.help-modal-body ul {
    margin: 16px 0 0 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.help-modal-body li {
    font-size: 0.95rem;
}

.help-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- INVESTIGATION SIDEBAR EXTENSIONS --- */
.investigation-sidebar-card.is-secret {
    border-left: 3px solid var(--primary-color) !important;
    background: linear-gradient(to right, rgba(var(--primary-color-rgb), 0.05), transparent);
}

.secret-icon-sidebar {
    filter: drop-shadow(0 0 2px rgba(var(--primary-color-rgb), 0.3));
}

.sidebar-investigation-meta {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.meta-location {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-location i {
    width: 12px;
    height: 12px;
}

.meta-characters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.meta-characters i {
    width: 12px;
    height: 12px;
    margin-right: 2px;
}

.char-tag-compact {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.status-pill-compact {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 700;
}

.status-pill-compact.status-verified {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-pill-compact.status-disputed {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.status-pill-compact.status-false {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* --- SIDEBAR MMO WIDGET --- */
.sidebar-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary-color);
    letter-spacing: 0.5px;
    background: rgba(var(--bg-tertiary-rgb), 0.3);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.sidebar-mmo-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 16px 16px 16px;
}

.sidebar-mmo-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    transition: all 0.2s ease;
}

.sidebar-mmo-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.mmo-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.mmo-char-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.mmo-char-name {
    flex: 1;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.mmo-edit-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.mmo-edit-btn:hover {
    color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.1);
}

.mmo-quick-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mmo-mini-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
}

.mmo-mini-label {
    width: 12px;
    font-weight: 800;
    color: var(--text-muted);
}

.mmo-mini-track {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.mmo-mini-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mmo-mini-fill.motive {
    background: var(--accent-red);
}

.mmo-mini-fill.means {
    background: var(--accent-gold);
}

.mmo-mini-fill.opportunity {
    background: var(--accent-green);
}

.mmo-mini-val {
    width: 16px;
    text-align: right;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 16px;
    opacity: 0.5;
}

.reset-all-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ef4444 !important;
    color: white !important;
    border: none !important;
    padding: 6px 14px !important;
    border-radius: 8px !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2) !important;
}

.reset-all-btn:hover {
    background: #dc2626 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3) !important;
}

.reset-all-btn i {
    width: 14px !important;
    height: 14px !important;
    stroke-width: 3 !important;
}


/* --- PREMIUM UI OVERRIDES (Theme Manager Harmony) --- */
.investigation-dashboard {
    background: radial-gradient(circle at top left, rgba(var(--primary-color-rgb), 0.03), transparent 40%), var(--bg-primary) !important;
}

.overview-card {
    background: rgba(var(--bg-primary-rgb), 0.7) !important;
    backdrop-filter: blur(12px) saturate(160%) !important;
    border: 1px solid rgba(var(--border-color-rgb), 0.5) !important;
    border-radius: 24px !important;
    padding: 28px !important;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04) !important;
    position: relative !important;
    overflow: hidden !important;
}

.overview-card:hover {
    transform: translateY(-8px) !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.1) !important;
    border-color: var(--primary-color) !important;
}

.overview-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle at top right, rgba(var(--primary-color-rgb), 0.1), transparent 70%) !important;
    pointer-events: none !important;
}

.overview-card .card-title {
    font-size: 0.75rem !important;
    font-weight: 800 !important;
    color: var(--text-muted) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.12em !important;
}

.stat-main {
    font-size: 2.6rem !important;
    font-weight: 800 !important;
    font-family: 'Noto Serif JP', serif !important;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--primary-color) 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    margin: 4px 0 !important;
}

.case-item {
    margin: 4px 8px !important;
    border-radius: 12px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: 1px solid transparent !important;
}

.case-item:hover {
    background: rgba(var(--primary-color-rgb), 0.05) !important;
}

.case-item.active {
    background: var(--bg-primary) !important;
    background: rgba(var(--bg-primary-rgb), 0.9) !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid rgba(var(--primary-color-rgb), 0.2) !important;
}

.case-item.active .case-icon-box {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover)) !important;
    color: white !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.3) !important;
    border: none !important;
}

.case-status-pill {
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    letter-spacing: 0.03em !important;
    font-weight: 800 !important;
    border-radius: 4px;
    background-clip: padding-box !important;
}

.case-status-pill.status-open {
    background: rgba(var(--accent-red-rgb), 0.12) !important;
    color: var(--accent-red) !important;
}

.case-status-pill.status-in_progress {
    background: rgba(var(--accent-gold-rgb), 0.15) !important;
    color: #d97706 !important;
}

.case-status-pill.status-solved {
    background: rgba(var(--accent-green-rgb), 0.12) !important;
    color: var(--accent-green) !important;
}

.case-status-pill.status-closed {
    background: var(--bg-tertiary) !important;
    color: var(--text-muted) !important;
}


.card-header-mini {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    margin-bottom: 12px !important;
}

.card-icon-bg {
    width: 32px !important;
    height: 32px !important;
    color: var(--primary-color) !important;
    opacity: 0.15 !important;
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
    transform: rotate(-5deg) !important;
    transition: all 0.3s ease !important;
}

.overview-card:hover .card-icon-bg {
    transform: rotate(0) scale(1.2) !important;
    opacity: 0.3 !important;
}

.suspect-mini-profile {
    background: rgba(var(--bg-primary-rgb), 0.5) !important;
    padding: 4px 10px 4px 6px !important;
    border-radius: 30px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    border: 1px solid var(--border-color) !important;
    transition: all 0.2s !important;
}

.suspect-mini-profile:hover {
    transform: scale(1.05) !important;
    background: var(--bg-primary) !important;
    border-color: var(--primary-color) !important;
}


.overview-header {
    padding: 32px 0 !important;
    border-bottom: 1px solid rgba(var(--border-color-rgb), 0.4) !important;
    margin-bottom: 40px !important;
    align-items: center !important;
}

.overview-title-group h2 {
    font-size: 2.8rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em !important;
    font-family: 'Noto Serif JP', serif !important;
    margin: 4px 0 0 0 !important;
}

.overview-label {
    font-size: 0.8rem !important;
    letter-spacing: 0.15em !important;
    opacity: 0.7 !important;
}


/* Sidebar MMO Incident Selector */
.sidebar-section-header.mmo-sidebar-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 16px;
}

.mmo-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-section-header select.mmo-incident-selector-sidebar {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 8px;
    width: 100%;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    text-transform: none;
}

.sidebar-section-header select.mmo-incident-selector-sidebar:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.sidebar-section-header select.mmo-incident-selector-sidebar option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* --- TIMELINE MATRIX VIEW --- */

/* --- TIMELINE MATRIX VIEW - REFINED --- */
.timeline-matrix-wrapper {
    overflow: auto;
    max-height: calc(100vh - 180px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    margin: 0;
    width: 100%;
}

.timeline-matrix-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    table-layout: fixed;
}

.timeline-matrix-table th,
.timeline-matrix-table td {
    border: 1px solid var(--border-color);
    padding: 0;
}

.timeline-matrix-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
    padding: 12px 16px;
    text-align: left;
    height: 100px;
}

.timeline-matrix-table .sticky-col {
    position: sticky;
    left: 0;
    background: var(--bg-secondary);
    z-index: 9;
    width: 300px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.timeline-matrix-table thead th.first-col {
    z-index: 11;
    background: var(--bg-secondary);
}

.fact-col-header {
    width: 240px;
}

.fact-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-primary);
}

.fact-header-content i {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

.act-separator {
    background: rgba(var(--primary-color-rgb), 0.1);
}

.act-separator-label {
    padding: 12px 20px;
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.scene-row-header {
    padding: 16px 20px !important;
}

.scene-row-header .scene-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
}

.scene-row-header .scene-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.step-cell {
    padding: 15px !important;
    cursor: pointer;
    vertical-align: top;
    transition: all 0.2s;
    background: var(--bg-primary);
}

.step-cell:hover {
    background: rgba(var(--primary-color-rgb), 0.05) !important;
}

.step-cell-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step-status-tag {
    font-size: 0.7rem;
    font-weight: 900;
    padding: 4px 10px;
    border-radius: 6px;
    width: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fff !important;
    /* Force white text for status contrast */
}

.step-who {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-who::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    flex-shrink: 0;
}

.step-comment {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status specific colors for cells with better contrast */
.step-cell.status-revealed {
    border-left: 5px solid var(--success-color);
}

.step-cell.status-hinted {
    border-left: 5px solid var(--warning-color);
}

.step-cell.status-disputed {
    border-left: 5px solid var(--danger-color);
}

.step-cell.status-confirmed {
    border-left: 5px solid var(--primary-color);
}

/* Ensuring the tag background is solid for readability */
.step-cell.status-revealed .step-status-tag {
    background: #059669 !important;
}

.step-cell.status-hinted .step-status-tag {
    background: #d97706 !important;
}

.step-cell.status-disputed .step-status-tag {
    background: #dc2626 !important;
}

.step-cell.status-confirmed .step-status-tag {
    background: var(--primary-color) !important;
}

/* Theme Manager Compatibility */
[data-theme="dark"] .step-cell.status-revealed .step-status-tag {
    background: #10b981 !important;
}

[data-theme="dark"] .step-cell.status-hinted .step-status-tag {
    background: #f59e0b !important;
}

[data-theme="dark"] .step-cell.status-disputed .step-status-tag {
    background: #ef4444 !important;
}

.empty-cell {
    background: radial-gradient(var(--border-color) 1px, transparent 1px);
    background-size: 16px 16px;
    opacity: 0.3;
}

/* --- TOOLBAR TOGGLE --- */
.view-mode-toggle {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2px;
    align-self: center;
}

.btn-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-toggle:hover {
    color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.05);
}

.btn-toggle.active {
    color: var(--primary-color);
    background: var(--bg-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-toggle i {
    width: 18px;
    height: 18px;
}

.timeline-compact.investigation-timeline {
    max-width: none !important;
    margin: 0 !important;
    padding: 24px !important;
    width: 100% !important;
}

/* Custom Scrollbar */
.timeline-matrix-wrapper::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.timeline-matrix-wrapper::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.timeline-matrix-wrapper::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 6px;
    border: 3px solid var(--bg-secondary);
}

.timeline-matrix-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}