.ii-wlw {
	display: flex;
	flex-direction: column;
	width: 280px;
	max-width: 100%;
	overflow: hidden;
}

.ii-wlw-search {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	border-bottom: 1px solid var(--ii-border);
	flex-shrink: 0;
}

.ii-wlw-search-icon {
	display: flex;
	color: var(--ii-text-tertiary);
	flex-shrink: 0;
}

.ii-wlw-search-input {
	flex: 1;
	min-width: 0;
	border: none;
	outline: none;
	background: none;
	font-size: 13px;
	font-family: var(--ii-font-body);
	color: var(--ii-text-primary);
}

.ii-wlw-search-input::placeholder {
	color: var(--ii-text-tertiary);
}

.ii-wlw-list {
	max-height: 320px;
	overflow-y: auto;
	padding-top: 8px;
}

/* Time-based sections, mirroring the sidebar's but sized for the popper: the
   sidebar's own rules carry its 20px gutter and a much larger group gap. */
.ii-wlw-group {
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.ii-wlw-group + .ii-wlw-group {
	margin-top: var(--ii-space-4);
}

/* line-height is pinned rather than left at normal so the skeleton's stand-in
   label can reserve exactly this height. */
.ii-wlw-group-label {
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
	color: var(--ii-text-tertiary);
	padding: 4px 8px 8px;
	user-select: none;
}

/* The row wraps the link and its options button. Hover lives here, not on the
   link, or the highlight would stop short of the button. */
.ii-wlw-row {
	display: flex;
	align-items: center;
	border-radius: var(--ii-radius-md);
}

.ii-wlw-row:hover,
.ii-wlw-row.is-active,
.ii-wlw-row:focus-within,
.ii-wlw-row:has(.is-popper-open) {
	background: var(--ii-bg-hover);
}

.ii-wlw-item-menu {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	margin-right: 5px;
	padding: 0;
	border: 1px solid transparent;
	border-radius: var(--ii-radius-sm);
	background: none;
	color: var(--ii-text-tertiary);
	cursor: pointer;
	opacity: 0;
	transition:
		opacity 120ms ease,
		background 120ms ease,
		color 120ms ease;
}

/* Same reveal rule as the sidebar: pointer hover, keyboard focus, or the menu
   standing open, so the trigger cannot vanish under its own popper. */
.ii-wlw-row:hover .ii-wlw-item-menu,
.ii-wlw-item-menu:focus-visible,
.ii-wlw-item-menu.is-popper-open {
	opacity: 1;
}

.ii-wlw-item-menu:hover,
.ii-wlw-item-menu.is-popper-open {
	background: var(--ii-bg-active);
	color: var(--ii-text-primary);
}

.ii-wlw-item-menu.is-popper-open {
	border-color: var(--ii-border);
}

.ii-wlw-item-menu:focus-visible {
	outline: 2px solid var(--ii-accent);
	outline-offset: -2px;
}

/* Touch has no hover, so the button would never appear. */
@media (hover: none) and (pointer: coarse) {
	.ii-wlw-item-menu {
		opacity: 1;
	}
}

/* Anchor rows (the workspace search popper): underline only, the base rule
   already sets colour and the button reset covers the rest. */
a.ii-wlw-item,
a.ii-wlw-item:hover,
a.ii-wlw-item:focus {
	text-decoration: none;
}

.ii-wlw-item {
	display: flex;
	align-items: center;
	gap: 9px;
	flex: 1;
	min-width: 0;
	padding: 7px 8px 7px 10px;
	margin: 0;
	border: none;
	background: none;
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.155;
	text-align: left;
	white-space: nowrap;
	color: var(--ii-text-primary);
	border-radius: var(--ii-radius-md);
	cursor: pointer;
	user-select: none;
	transition:
		background 120ms ease,
		color 120ms ease;
}

.ii-wlw-item:focus-visible {
	outline: 2px solid var(--ii-accent);
	outline-offset: -2px;
}

.ii-wlw-item-thumb {
	width: 36px;
	height: 36px;
	min-width: 36px;
	border-radius: 4px;
	overflow: hidden;
	flex-shrink: 0;
	background: var(--ii-bg-tertiary);
	border: 1px solid var(--ii-border);
	display: flex;
	align-items: center;
	justify-content: center;
}

.ii-wlw-item-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ii-wlw-item-thumb svg {
	opacity: 0.35;
}

.ii-wlw-item-label {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.155;
}

/* Popper hosts use slightly roomier item metrics than the context menu */
.ii-popper-menu .ii-wlw-item,
.ii-popper-sub-panel .ii-wlw-item {
	gap: 8px;
	padding: 8px;
}

.ii-wlw-status {
	padding: 14px 12px;
	text-align: center;
	font-size: 13px;
	color: var(--ii-text-tertiary);
}

.ii-wlw-sentinel {
	height: 1px;
}

.ii-wlw-loading {
	display: none;
	align-items: center;
	justify-content: center;
	padding: 10px 12px;
	animation: iiWlwLoadingIn 160ms ease both;
}

@keyframes iiWlwLoadingIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.ii-wlw-spinner {
	display: inline-flex;
	width: 16px;
	height: 16px;
	border: 2px solid var(--ii-text-tertiary);
	border-top-color: transparent;
	border-radius: 50%;
	animation: ai-toast-spin 0.65s linear infinite;
	flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
	.ii-wlw-spinner {
		animation: none;
		opacity: 0.6;
	}
}

/* Metrics copied from .ii-wlw-item / .ii-wlw-item-thumb, not chosen: a skeleton
   row that is not exactly as tall as the row replacing it makes the widget
   resize on load, and every popper hosting it re-anchors and jumps. */
.ii-wlw-skeleton-row {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 7px 8px 7px 10px;
}

.ii-popper-menu .ii-wlw-skeleton-row,
.ii-popper-sub-panel .ii-wlw-skeleton-row {
	gap: 8px;
	padding: 8px;
}

/* Stands in for .ii-wlw-group-label, which only the loaded list has. Height
   comes from the shared label rule; this only fills it with a shimmer bar. */
.ii-wlw-skeleton-label::before {
	content: '';
	display: block;
	width: 64px;
	height: 1.2em;
	border-radius: 4px;
	background: var(--ii-skeleton-gradient);
	background-size: 200% 100%;
	animation: iiSkeletonShimmer 1.8s infinite linear;
}

.ii-wlw-skeleton-thumb {
	width: 36px;
	height: 36px;
	min-width: 36px;
	border-radius: 4px;
	background: var(--ii-skeleton-gradient);
	background-size: 200% 100%;
	animation: iiSkeletonShimmer 1.8s infinite linear;
}

.ii-wlw-skeleton-line {
	flex: 1;
	height: 10px;
	border-radius: 4px;
	background: var(--ii-skeleton-gradient);
	background-size: 200% 100%;
	animation: iiSkeletonShimmer 1.8s infinite linear;
}

.ii-cmenu-sub-custom {
	padding: 0;
}

.ii-popper-sub-panel:has(.ii-wlw) {
	padding: 0;
}

/* container padding is zeroed for a full-bleed search bar; inset the list instead */
.ii-cmenu-sub-custom .ii-wlw-list,
.ii-popper-sub-panel .ii-wlw-list {
	padding-left: 5px;
	padding-right: 5px;
}
