#viewer {
	display: flex;
	flex-direction: row;
	align-items: stretch;
	width: 100%;
	height: calc(100vh - 160px);
	min-height: 420px;
	background: #0a0c12;
	border: 1px solid #1f2439;
	border-radius: 10px;
	overflow: hidden;
}

.panel {
	display: flex;
	flex-direction: column;
	min-width: 0;
	border-right: 1px solid #1f2439;
}

.panel:last-child {
	border-right: none;
}

#bus-panel {
	flex: 0 0 260px;
	background: #070910;
}

#node-panel {
	flex: 0 0 250px;
	background: #0b0e16;
}

#msg-panel {
	flex: 1 1 0;
	background: #0d1018;
}

.panel-header {
	flex-shrink: 0;
	padding: 12px 14px 10px;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	color: #7f8ca4;
	border-bottom: 1px solid #1f2439;
	background: rgba(5, 7, 12, 0.7);
}

.panel-list {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 4px 0;
}

.panel-list::-webkit-scrollbar {
	width: 6px;
}

.panel-list::-webkit-scrollbar-track {
	background: transparent;
}

.panel-list::-webkit-scrollbar-thumb {
	background: #303b68;
	border-radius: 4px;
}

.placeholder {
	display: block;
	padding: 14px;
	font-size: 0.82rem;
	font-style: italic;
	color: #667189;
}

.panel-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 9px 14px;
	font-size: 0.85rem;
	color: #b8c3d8;
	cursor: pointer;
	user-select: none;
	border-left: 3px solid transparent;
	transition:
		background 0.12s,
		color 0.12s,
		border-color 0.12s;
}

.panel-item:hover {
	background: #11172a;
	color: #f8fafc;
}

.panel-item.active {
	background: #151d33;
	color: #ffffff;
	border-left-color: #8b5cf6;
}

.item-label {
	flex: 1 1 auto;
	min-width: 0;
	word-break: break-word;
}

.item-chevron {
	flex-shrink: 0;
	color: #67728b;
}

.item-accent {
	flex: 0 0 auto;
	font-size: 0.68rem;
	font-family: "Fira Mono", "Consolas", monospace;
	color: #d8b4fe;
	background: rgba(91, 33, 182, 0.25);
	border: 1px solid rgba(167, 139, 250, 0.35);
	padding: 1px 6px;
	border-radius: 999px;
	margin-left: 4px;
}

.panel-item.active .item-chevron {
	color: #8b5cf6;
}

.msg-item {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 5px;
	padding: 10px 14px;
	border-left-color: transparent;
	cursor: default;
}

.msg-item:hover {
	background: #11162a;
}

.msg-name {
	font-size: 0.86rem;
	font-weight: 500;
	color: #f8fafc;
}

.msg-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.msg-badge {
	display: inline-block;
	padding: 2px 7px;
	border-radius: 999px;
	font-size: 0.68rem;
	font-family: "Fira Mono", "Consolas", monospace;
	background: #3b1157;
	color: #e9d5ff;
}

.msg-receivers {
	font-size: 0.76rem;
	color: #9babca;
}

.msg-bytes {
	margin-top: 4px;
	width: 100%;
	border-top: 1px solid #1f2439;
	padding-top: 6px;
}

.msg-byte-row {
	font-size: 0.74rem;
	line-height: 1.35;
	margin-bottom: 5px;
	color: #b9c3da;
}

.msg-byte-main {
	color: #dbe6ff;
}

.msg-type-chip {
	display: inline-block;
	margin-left: 6px;
	padding: 1px 6px;
	border-radius: 999px;
	font-size: 0.63rem;
	font-family: "Fira Mono", "Consolas", monospace;
	color: #c4b5fd;
	background: rgba(91, 33, 182, 0.2);
	border: 1px solid rgba(167, 139, 250, 0.3);
	vertical-align: middle;
}

.msg-byte-bits {
	color: #9aa8c8;
}

.msg-byte-comment {
	margin-top: 1px;
	color: #7f8ca6;
	font-style: italic;
}

#viewer-search-row {
	padding: 0 0 8px;
	position: relative;
}

#viewer-search {
	width: 100%;
	font-family: inherit;
	font-size: 0.82rem;
	padding: 8px 12px;
	border-radius: 8px;
	border: 1px solid #2c3350;
	background: #0a0c13;
	color: #ecf2ff;
	outline: none;
	transition:
		border-color 0.16s,
		box-shadow 0.16s;
}

#viewer-search:focus {
	border-color: #7c3aed;
	box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

#viewer-search::placeholder {
	color: #667189;
}

#search-dropdown {
	display: none;
	position: absolute;
	top: calc(100% - 8px);
	left: 0;
	right: 0;
	z-index: 50;
	background: #0d1020;
	border: 1px solid #2c3350;
	border-top: none;
	border-radius: 0 0 8px 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
	max-height: 280px;
	overflow-y: auto;
}

.search-result-row {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 8px 12px;
	cursor: pointer;
	border-bottom: 1px solid #1a1f35;
	transition: background 0.1s;
}

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

.search-result-row:hover {
	background: #151d33;
}

.sr-name {
	font-size: 0.84rem;
	font-weight: 500;
	color: #f0f4ff;
}

.sr-path {
	font-size: 0.72rem;
	color: #667189;
}

@keyframes highlight-fade {
	0% {
		background: rgba(139, 92, 246, 0.35);
	}
	100% {
		background: transparent;
	}
}

.msg-highlight {
	animation: highlight-fade 1.8s ease-out forwards;
	border-radius: 4px;
}

/* ── Message expand/collapse toggle ── */
.msg-expand-btn {
	flex-shrink: 0;
	color: #8b5cf6;
	cursor: pointer;
	font-size: 0.82rem;
	line-height: 1;
	padding: 0 2px;
	transform: rotate(90deg);
	transition:
		transform 0.12s,
		color 0.12s;
	user-select: none;
}

.msg-expand-btn.collapsed {
	transform: rotate(0deg);
	color: #67728b;
}

.msg-details {
	width: 100%;
	overflow: hidden;
	max-height: 600px;
	transition: max-height 0.15s ease-out;
}

.msg-details.collapsed {
	max-height: 0;
}
